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:
Luke Robles 2023-03-14 09:14:31 -07:00
parent f0c70008c9
commit f10689b9b1
2 changed files with 11 additions and 9 deletions

View File

@ -15,7 +15,9 @@ def get_player(player):
response = requests.get(url, headers=headers).json() response = requests.get(url, headers=headers).json()
# Build the embed # 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_thumbnail(url=response["avatar"])
embed.set_author(name="Battlefield 2042 stats for %s" % response["userName"]) embed.set_author(name="Battlefield 2042 stats for %s" % response["userName"])
# embed.add_field( # embed.add_field(
@ -49,8 +51,6 @@ def get_player(player):
} }
for stat, readable in gameplay_stats.items(): for stat, readable in gameplay_stats.items():
print(stat)
print(readable)
embed.add_field( embed.add_field(
name="**%s**" % readable, name="**%s**" % readable,
value=response[stat], value=response[stat],

View File

@ -60,12 +60,14 @@ class Games(commands.Cog):
async def battlefield(self, ctx: commands.Context, player_name: str): async def battlefield(self, ctx: commands.Context, player_name: str):
import battlefield import battlefield
# try: try:
embed = battlefield.get_player(player=player_name.lower()) embed = battlefield.get_player(player=player_name.lower())
await ctx.defer() await ctx.defer()
await ctx.send_followup(embed=embed) await ctx.send_followup(embed=embed)
# except Exception: except Exception as e:
# await ctx.send("I encountered an error while searching for that player.") await ctx.send(
"I encountered an error while searching for that player.\n\n%s" % e
)
def setup(bot): def setup(bot):