diff options
-rw-r--r-- | bot/constants.py | 4 | ||||
-rw-r--r-- | bot/seasons/season.py | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/bot/constants.py b/bot/constants.py index eff4897b..71bdbf5f 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -67,7 +67,7 @@ class Colours: class Emojis: star = "\u2B50" - christmas_tree = u"\U0001F384" + christmas_tree = "\U0001F384" check = "\u2611" @@ -77,7 +77,7 @@ class Hacktoberfest(NamedTuple): class Roles(NamedTuple): - admin = int(environ.get('SEASONALBOT_ADMIN', 267628507062992896)) + admin = int(environ.get('SEASONALBOT_ADMIN_ROLE_ID', 267628507062992896)) announcements = 463658397560995840 champion = 430492892331769857 contributor = 295488872404484098 diff --git a/bot/seasons/season.py b/bot/seasons/season.py index 66c90451..f1d570e0 100644 --- a/bot/seasons/season.py +++ b/bot/seasons/season.py @@ -1,4 +1,5 @@ import asyncio +import contextlib import datetime import importlib import inspect @@ -185,10 +186,8 @@ class SeasonBase: if bot.user.name != self.bot_name: # attempt to change user details log.debug(f"Changing username to {self.bot_name}") - try: + with contextlib.suppress(discord.HTTPException): await bot.user.edit(username=self.bot_name) - except discord.HTTPException: - pass # fallback on nickname if failed due to ratelimit if bot.user.name != self.bot_name: @@ -216,11 +215,9 @@ class SeasonBase: # attempt the change log.debug(f"Changing avatar to {self.icon}") icon = await self.get_icon() - try: + with contextlib.suppress(discord.HTTPException, asyncio.TimeoutError): async with async_timeout.timeout(5): await bot.user.edit(avatar=icon) - except (discord.HTTPException, asyncio.TimeoutError): - pass if bot.user.avatar != old_avatar: log.debug(f"Avatar changed to {self.icon}") @@ -242,11 +239,9 @@ class SeasonBase: # attempt the change log.debug(f"Changing server icon to {self.icon}") icon = await self.get_icon() - try: + with contextlib.suppress(discord.HTTPException, asyncio.TimeoutError): async with async_timeout.timeout(5): await guild.edit(icon=icon, reason=f"Seasonbot Season Change: {self.name}") - except (discord.HTTPException, asyncio.TimeoutError): - pass new_icon = bot.get_guild(Client.guild).icon if new_icon != old_icon: |