1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-26 06:57:29 +00:00

Added task removal on guild leave

This commit is contained in:
Myned 2017-11-20 02:15:20 -05:00
parent 7caf76d84f
commit e997c242ea

View file

@ -114,6 +114,17 @@ async def on_command_completion(ctx):
if ctx.command.name != 'lastcommand': if ctx.command.name != 'lastcommand':
u.last_commands[ctx.author.id] = ctx u.last_commands[ctx.author.id] = ctx
@bot.event
async def on_guild_remove(guild):
print(f'LEFT : {guild.name}')
for task, idents in u.tasks.items():
for channel in guild.channels:
if channel.id in idents:
idents.remove(channel.id)
print(f'STOPPED : {task} in #{channel.id}')
u.dump(u.tasks, 'cogs/tasks.pkl')
# d.opus.load_opus('opus') # d.opus.load_opus('opus')