aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Scragly <[email protected]>2019-04-21 09:35:36 +1000
committerGravatar Scragly <[email protected]>2019-04-21 09:35:36 +1000
commit890a0e1eb045b3a984ccb10a6e3007c21761edda (patch)
tree1537aee65fc8257a75b4d4e5bb63986d6ce775d0
parentAllow prefix env, move db location. (diff)
Prevent weird errors, adjust constants to prod IDs.
-rw-r--r--bot/seasons/easter/egg_hunt/cog.py19
-rw-r--r--bot/seasons/easter/egg_hunt/constants.py8
2 files changed, 17 insertions, 10 deletions
diff --git a/bot/seasons/easter/egg_hunt/cog.py b/bot/seasons/easter/egg_hunt/cog.py
index e963f22b..758a4da3 100644
--- a/bot/seasons/easter/egg_hunt/cog.py
+++ b/bot/seasons/easter/egg_hunt/cog.py
@@ -178,7 +178,8 @@ class EggMessage:
log.debug(f"EggHunt session started for message {self.message.id}.")
bot.add_listener(self.collect_reacts, name="on_reaction_add")
- await self.message.add_reaction(self.egg)
+ with contextlib.suppress(discord.Forbidden):
+ await self.message.add_reaction(self.egg)
self.timeout_task = asyncio.create_task(self.start_timeout(300))
@@ -191,8 +192,10 @@ class SuperEggMessage(EggMessage):
async def finalise_score(self):
"""Sums and actions scoring for this super egg session."""
-
- message = await self.message.channel.get_message(self.message.id)
+ try:
+ message = await self.message.channel.get_message(self.message.id)
+ except discord.NotFound:
+ return
count = 0
white = 0
@@ -257,7 +260,8 @@ class SuperEggMessage(EggMessage):
db.close()
embed.set_footer(text=f"Finished with {count} total reacts.")
- await self.message.edit(embed=embed)
+ with contextlib.suppress(discord.HTTPException):
+ await self.message.edit(embed=embed)
async def start_timeout(self, seconds=None):
"""Starts the super egg session."""
@@ -269,7 +273,10 @@ class SuperEggMessage(EggMessage):
await asyncio.sleep(1)
embed = self.message.embeds[0]
embed.set_footer(text=f"Finishing in {count} minutes.")
- await self.message.edit(embed=embed)
+ try:
+ await self.message.edit(embed=embed)
+ except discord.HTTPException:
+ break
count -= 1
bot.remove_listener(self.collect_reacts, name="on_reaction_add")
await self.finalise_score()
@@ -376,7 +383,7 @@ class EggHunt(commands.Cog):
if message.author.bot:
return
- if random.randrange(100) <= 40:
+ if random.randrange(100) <= 5:
await EggMessage(message, random.choice([Emoji.egg_white, Emoji.egg_blurple])).start()
@commands.group(invoke_without_command=True)
diff --git a/bot/seasons/easter/egg_hunt/constants.py b/bot/seasons/easter/egg_hunt/constants.py
index d3ab5962..6a673686 100644
--- a/bot/seasons/easter/egg_hunt/constants.py
+++ b/bot/seasons/easter/egg_hunt/constants.py
@@ -26,10 +26,10 @@ class Roles:
class Emoji:
- egg_white = bot.get_emoji(569006388437844023)
- egg_blurple = bot.get_emoji(569006905972752384)
- egg_gold = bot.get_emoji(569079769736675328)
- egg_diamond = bot.get_emoji(569109259288182784)
+ egg_white = bot.get_emoji(569266762428841989)
+ egg_blurple = bot.get_emoji(569266666094067819)
+ egg_gold = bot.get_emoji(569266900106739712)
+ egg_diamond = bot.get_emoji(569266839738384384)
class Colours: