diff --git a/waggle-dance.py b/waggle-dance.py index c958197..bde3988 100755 --- a/waggle-dance.py +++ b/waggle-dance.py @@ -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)