fix (rooms): Harden turnover to deletion.

Fix an issue where `TimeSlot.start()` could propagate an exception.
This commit is contained in:
2021-10-19 20:21:57 +03:00
parent 7c2a6c39a7
commit 6a43530142
2 changed files with 16 additions and 4 deletions

View File

@@ -334,10 +334,21 @@ class TimeSlot:
Update the status message, and launch the DM reminder. Update the status message, and launch the DM reminder.
""" """
if self.channel: if self.channel:
await self.channel.edit(name="Accountability Study Room") try:
await self.channel.set_permissions(self.guild.default_role, view_channel=True, connect=False) await self.channel.edit(name="Accountability Study Room")
await self.channel.set_permissions(self.guild.default_role, view_channel=True, connect=False)
except discord.HTTPException:
pass
asyncio.create_task(self.dm_reminder(delay=60)) asyncio.create_task(self.dm_reminder(delay=60))
await self.message.edit(embed=self.status_embed) try:
await self.message.edit(embed=self.status_embed)
except discord.NotFound:
try:
self.message = await self.lobby.send(
embed=self.status_embed
)
except discord.HTTPException:
self.message = None
async def dm_reminder(self, delay=60): async def dm_reminder(self, delay=60):
""" """

View File

@@ -232,7 +232,8 @@ async def turnover():
# Start all the current rooms # Start all the current rooms
await asyncio.gather( await asyncio.gather(
*(slot.start() for slot in current_slots) *(slot.start() for slot in current_slots),
return_exceptions=True
) )