mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Moved setdefault to the if statement, changed output, added error catch
This commit is contained in:
parent
9c06d7bfa9
commit
da78317188
1 changed files with 5 additions and 3 deletions
|
@ -169,13 +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()
|
traceback.print_exc()
|
||||||
|
|
Loading…
Reference in a new issue