mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 14:27:27 +00:00
Added task removal on guild leave
This commit is contained in:
parent
7caf76d84f
commit
e997c242ea
1 changed files with 11 additions and 0 deletions
|
@ -114,6 +114,17 @@ async def on_command_completion(ctx):
|
|||
if ctx.command.name != 'lastcommand':
|
||||
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')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue