From 9c06d7bfa9d5f22396e93bf5ef35723eb3faed6f Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 11 Oct 2017 11:25:37 -0400 Subject: [PATCH 1/2] Removed traceback limit --- src/main/cogs/management.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/cogs/management.py b/src/main/cogs/management.py index 97f12ba..4d76234 100644 --- a/src/main/cogs/management.py +++ b/src/main/cogs/management.py @@ -129,7 +129,7 @@ class Administration: await ctx.send('❌ **Deletion timed out.**', delete_after=10) except Exception: await ctx.send('{}\n```{}```'.format(exc.base, traceback.format_exc(limit=1))) - traceback.print_exc(limit=1) + traceback.print_exc() async def delete(self): while True: @@ -160,7 +160,7 @@ class Administration: pass except Exception: 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.has_permissions(administrator=True) @@ -178,3 +178,4 @@ class Administration: await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5) else: raise exc.Exists except exc.Exists: await ctx.send('❌ **Already deleting in this channel.** Type `stop` to stop deleting.') + traceback.print_exc() From da7831718845f51fe0eb1cdf2c9050ddadf7f44c Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 11 Oct 2017 11:26:26 -0400 Subject: [PATCH 2/2] Moved setdefault to the if statement, changed output, added error catch --- src/main/cogs/management.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/cogs/management.py b/src/main/cogs/management.py index 4d76234..36aed10 100644 --- a/src/main/cogs/management.py +++ b/src/main/cogs/management.py @@ -169,13 +169,15 @@ class Administration: channel = ctx.message.channel try: - if channel.id not in u.background['management']['auto_delete']: - u.background.setdefault('management', {}).setdefault('auto_delete', []).append(channel.id) + if channel.id not in u.background.setdefault('management', {}).setdefault('auto_delete', []): + u.background['management']['auto_delete'].append(channel.id) u.update(u.background, 'background.json') self.bot.loop.create_task(self.on_message(channel)) self.bot.loop.create_task(self.delete()) print('Looping {}'.format(channel.id)) await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5) 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()