better handling of AttributeError

This commit is contained in:
Arthur Lu 2022-08-23 01:53:56 +00:00
parent 0fc83134a9
commit bc18614027

View File

@ -82,6 +82,7 @@ async def leave(ctx):
await ctx.voice_client.disconnect()
bot.queue = None
shutil.rmtree('session/') # temporary cleanup procedure, will add caching later
@bot.command()
async def skip(ctx):
@ -141,6 +142,8 @@ async def start_playing(ctx):
event = asyncio.Event()
event.set()
try:
while bot.queue.has_next():
event.clear()
@ -166,8 +169,13 @@ async def start_playing(ctx):
await event.wait()
await ctx.voice_client.disconnect()
shutil.rmtree('session/') # temporary cleanup procedure, will add caching later
except AttributeError:
pass
except Exception as e:
print(e)
bot.queue = None
bot.start_playing = start_playing