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

Merge branch 'dev'

This commit is contained in:
Myned 2017-10-11 11:26:41 -04:00
commit 1e8b766425

View file

@ -129,7 +129,7 @@ class Administration:
await ctx.send('❌ **Deletion timed out.**', delete_after=10) await ctx.send('❌ **Deletion timed out.**', delete_after=10)
except Exception: except Exception:
await ctx.send('{}\n```{}```'.format(exc.base, traceback.format_exc(limit=1))) await ctx.send('{}\n```{}```'.format(exc.base, traceback.format_exc(limit=1)))
traceback.print_exc(limit=1) traceback.print_exc()
async def delete(self): async def delete(self):
while True: while True:
@ -160,7 +160,7 @@ class Administration:
pass pass
except Exception: except Exception:
await channel.send(exc.base + '\n```' + traceback.format_exc(limit=1) + '```') await channel.send(exc.base + '\n```' + traceback.format_exc(limit=1) + '```')
traceback.print_exc(limit=1) traceback.print_exc()
@commands.command(name='autodelete', aliases=['autodel', 'ad']) @commands.command(name='autodelete', aliases=['autodel', 'ad'])
@commands.has_permissions(administrator=True) @commands.has_permissions(administrator=True)
@ -169,12 +169,15 @@ class Administration:
channel = ctx.message.channel channel = ctx.message.channel
try: try:
if channel.id not in u.background['management']['auto_delete']: if channel.id not in u.background.setdefault('management', {}).setdefault('auto_delete', []):
u.background.setdefault('management', {}).setdefault('auto_delete', []).append(channel.id) u.background['management']['auto_delete'].append(channel.id)
u.update(u.background, 'background.json') u.update(u.background, 'background.json')
self.bot.loop.create_task(self.on_message(channel)) self.bot.loop.create_task(self.on_message(channel))
self.bot.loop.create_task(self.delete()) self.bot.loop.create_task(self.delete())
print('Looping {}'.format(channel.id)) print('Looping {}'.format(channel.id))
await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5) await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5)
else: raise exc.Exists else: raise exc.Exists
except exc.Exists: await ctx.send('❌ **Already deleting in this channel.** Type `stop` to stop deleting.') except exc.Exists: await ctx.send('❌ **Already auto-deleting in this channel.** Type `stop` to stop.', delete_after=10)
except Exception:
await channel.send(exc.base + '\n```' + traceback.format_exc(limit=1) + '```')
traceback.print_exc()