diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 821eda2..3b04df0 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -164,7 +164,10 @@ class MsG: tb.print_exc() finally: if starred: - for url in starred: await user.send(url) + for url in starred: + await user.send(url) + if len(starred) > 5: + await asyncio.sleep(2.1) @e621_paginator.error async def e621_paginator_error(self, ctx, error): diff --git a/src/main/cogs/management.py b/src/main/cogs/management.py index 8fb4d7a..6860623 100644 --- a/src/main/cogs/management.py +++ b/src/main/cogs/management.py @@ -168,9 +168,14 @@ class Administration: @checks.del_ctx() async def auto_delete(self, ctx): channel = ctx.message.channel - u.background.setdefault('management', {}).setdefault('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) + + try: + if channel.id not in u.background['management']['auto_delete']: + u.background.setdefault('management', {}).setdefault('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.**') diff --git a/src/main/misc/exceptions.py b/src/main/misc/exceptions.py index 4c3e403..8db2366 100644 --- a/src/main/misc/exceptions.py +++ b/src/main/misc/exceptions.py @@ -3,6 +3,7 @@ base = '⚠️ **An internal error has occurred.** Please notify my master! 🐺 class Left(Exception): pass class Right(Exception): pass class Save(Exception): pass +class Exists(Exception): pass class PostError(Exception): pass class ImageError(Exception): pass class MatchError(Exception): pass diff --git a/src/main/run.py b/src/main/run.py index 0e68add..abf32ad 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -6,7 +6,7 @@ try: print('\"config.json\" loaded.') except FileNotFoundError: with open('config.json', 'w') as outfile: - json.dump({'client_id': 0, 'listed_ids': [0], 'owner_id': 0, 'permissions': 388160, 'prefix': ',', 'shutdown_channel': 0, 'startup_channel': 0, 'token': 'str'}, outfile, indent=4, sort_keys=True) + json.dump({'client_id': 0, 'listed_ids': [0], 'owner_id': 0, 'permissions': 126016, 'prefix': ',', 'shutdown_channel': 0, 'startup_channel': 0, 'token': 'str'}, outfile, indent=4, sort_keys=True) raise FileNotFoundError('Config file not found: \"config.json\" created with abstract values. Restart \"run.py\" with correct values.') import asyncio