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