diff options
author | AnInternetTroll <lucafulger@gmail.com> | 2020-06-29 12:13:57 +0000 |
---|---|---|
committer | AnInternetTroll <lucafulger@gmail.com> | 2020-06-29 12:13:57 +0000 |
commit | 1e2c28b9d7467f5c08466b770e1d61d67d197065 (patch) | |
tree | 16950b931cf34ad9e23304757a728680100b61f7 /cogs | |
parent | ba4272f2a15376b3df4880c97a7bfa7f445eb0c4 (diff) | |
download | steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.tar steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.tar.gz steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.tar.bz2 steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.tar.lz steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.tar.xz steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.tar.zst steve-bot-1e2c28b9d7467f5c08466b770e1d61d67d197065.zip |
Added xboxuser command
Diffstat (limited to 'cogs')
-rwxr-xr-x | cogs/general.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/cogs/general.py b/cogs/general.py index 0847cd4..9fc8f5c 100755 --- a/cogs/general.py +++ b/cogs/general.py @@ -1,6 +1,8 @@ from discord.ext import commands
import discord
import datetime
+import requests
+import json
def dump(obj):
output = ""
@@ -86,5 +88,67 @@ class General(commands.Cog): embed.set_footer(text=f"ID: {guild.id}")
await ctx.send(embed=embed)
+ @commands.command()
+ async def xboxUser(self, ctx, *, gamertag=None):
+ if not gamertag:
+ await ctx.send("You need to specify a gamer, gamer")
+ return
+
+ r = requests.get(f"https://xbl-api.prouser123.me/profile/gamertag/{gamertag}")
+ gamer = json.loads(r.text)
+
+ try:
+ await ctx.send(f"{gamer['error']}: {gamer['message']}")
+ return
+ except KeyError:
+ pass
+
+ for i in gamer["profileUsers"][0]["settings"]:
+ if i["id"] == "GameDisplayName":
+ gameName = i["value"]
+ continue
+ if i["id"] == "AppDisplayPicRaw":
+ picUrl = i["value"]
+ continue
+ if i["id"] == "Gamerscore":
+ Gamerscore = i["value"]+"<:gamerscore:727131234534424586>"
+ continue
+ if i["id"] == "AccountTier":
+ accountTier = i["value"]
+ continue
+ if i["id"] == "XboxOneRep":
+ reputation = i["value"]
+ continue
+ if i["id"] == "PreferredColor":
+ color = int(json.loads(requests.get(i["value"]).text)["primaryColor"], 16)
+ continue
+ if i["id"] == "Location":
+ location = i["value"]
+ continue
+ if i["id"] == "Bio":
+ #if len(i["value"]) == 0:
+ # Bio = "Unknown"
+ #else:
+ Bio = i["value"]
+ continue
+ if i["id"] == "Watermarks":
+ Watermarks = i["value"]
+ continue
+ if i["id"] == "RealName":
+ RealName = i["value"]
+ continue
+
+
+ embed=discord.Embed(title=gameName, description=Bio, color=color, timestamp=ctx.message.created_at)
+ embed.set_thumbnail(url=picUrl)
+ embed.add_field(name="Gamerscore", value=Gamerscore, inline=True)
+ if len(location) != 0:
+ embed.add_field(name="Location", value=location, inline=True)
+ if len(Watermarks) != 0:
+ embed.add_field(name="Watermarks", value=Watermarks, inline=True)
+ embed.add_field(name="Account Tier", value=accountTier, inline=True)
+ embed.add_field(name="Reputation", value=reputation, inline=True)
+ await ctx.send(embed=embed)
+
def setup(bot):
bot.add_cog(General(bot))
|