Changing the color of the 2042 embed and remvoing the leftover print statements. also wrapping it in a try except
This commit is contained in:
parent
f0c70008c9
commit
f10689b9b1
@ -15,7 +15,9 @@ def get_player(player):
|
||||
response = requests.get(url, headers=headers).json()
|
||||
|
||||
# Build the embed
|
||||
embed = discord.Embed(description="-------", color=15105570, type="rich")
|
||||
embed = discord.Embed(
|
||||
description="-------", color=discord.Color.teal(), type="rich"
|
||||
)
|
||||
embed.set_thumbnail(url=response["avatar"])
|
||||
embed.set_author(name="Battlefield 2042 stats for %s" % response["userName"])
|
||||
# embed.add_field(
|
||||
@ -49,8 +51,6 @@ def get_player(player):
|
||||
}
|
||||
|
||||
for stat, readable in gameplay_stats.items():
|
||||
print(stat)
|
||||
print(readable)
|
||||
embed.add_field(
|
||||
name="**%s**" % readable,
|
||||
value=response[stat],
|
||||
|
@ -60,12 +60,14 @@ class Games(commands.Cog):
|
||||
async def battlefield(self, ctx: commands.Context, player_name: str):
|
||||
import battlefield
|
||||
|
||||
# try:
|
||||
try:
|
||||
embed = battlefield.get_player(player=player_name.lower())
|
||||
await ctx.defer()
|
||||
await ctx.send_followup(embed=embed)
|
||||
# except Exception:
|
||||
# await ctx.send("I encountered an error while searching for that player.")
|
||||
except Exception as e:
|
||||
await ctx.send(
|
||||
"I encountered an error while searching for that player.\n\n%s" % e
|
||||
)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
|
Loading…
x
Reference in New Issue
Block a user