fix error handling

main
xenofem 2020-07-29 21:16:36 -04:00
parent f59d52577f
commit b74d9a9188
1 changed files with 5 additions and 5 deletions

View File

@ -96,7 +96,7 @@ async def delete_if_possible(channels):
for c in channels:
try:
await c.delete()
except:
except discord.DiscordException:
pass
async def countdown(channel):
@ -171,7 +171,7 @@ async def handle_guild_message(message):
await message.channel.send("looks like I'm not allowed to create voice channels :(")
await delete_if_possible(pollination_channels)
return
except discord.HTTPException as e:
except discord.DiscordException as e:
exception_count += 1
if exception_count > 20:
await message.channel.send("I'm trying to create voice channels, but something's wrong: {}".format(e))
@ -189,11 +189,11 @@ async def handle_guild_message(message):
for ((a, b), c) in zip(matching, pollination_channels):
try:
await a.move_to(c)
except e:
except discord.DiscordException as e:
print('failed to move participant {}: {}'.format(a, e), file=sys.stderr)
try:
await b.move_to(c)
except e:
except discord.DiscordException as e:
print('failed to move participant {}: {}'.format(b, e), file=sys.stderr)
await asyncio.sleep(60*3)
await message.channel.send('Round ending in 2 minutes {}'.format(mention_all))
@ -206,7 +206,7 @@ async def handle_guild_message(message):
for u in participants:
try:
await u.move_to(main_voice_channel)
except e:
except discord.DiscordException as e:
print('failed to move participant {}: {}'.format(u, e), file=sys.stderr)
await delete_if_possible(pollination_channels)