diff --git a/redbot/cogs/cleanup/cleanup.py b/redbot/cogs/cleanup/cleanup.py index 04ff18bcf..63bd76e31 100644 --- a/redbot/cogs/cleanup/cleanup.py +++ b/redbot/cogs/cleanup/cleanup.py @@ -41,7 +41,20 @@ class Cleanup: channel = ctx.channel author = ctx.author is_bot = self.bot.user.bot + + def author_check(message): + return message.author == author + if number > 100: + await ctx.send('Are you sure you want to delete {} messages? (y/n)'.format(number)) + response = await self.bot.wait_for('message', check=author_check) + + if response.content.startswith('y'): + tmp = await ctx.send('Continuing..') + await tmp.delete() + else: + return await ctx.send('Cancelled.') + def check(m): if text in m.content: return True @@ -90,6 +103,19 @@ class Cleanup: channel = ctx.channel author = ctx.author is_bot = self.bot.user.bot + + def author_check(message): + return message.author == author + + if number > 100: + await ctx.send('Are you sure you want to delete {} messages? (y/n)'.format(number)) + response = await self.bot.wait_for('message', check=author_check) + + if response.content.startswith('y'): + tmp = await ctx.send('Continuing..') + await tmp.delete() + else: + return await ctx.send('Cancelled.') def check(m): if isinstance(user, discord.Member) and m.author == user: @@ -185,9 +211,21 @@ class Cleanup: author = ctx.author is_bot = self.bot.user.bot + + def author_check(message): + return message.author == author + + if number > 100: + await ctx.send('Are you sure you want to delete {} messages? (y/n)'.format(number)) + response = await self.bot.wait_for('message', check=author_check) + + if response.content.startswith('y'): + tmp = await ctx.send('Continuing..') + await tmp.delete() + else: + return await ctx.send('Cancelled.') to_delete = [] - tmp = ctx.message done = False @@ -221,6 +259,19 @@ class Cleanup: author = ctx.message.author is_bot = self.bot.user.bot + def author_check(message): + return message.author == author + + if number > 100: + await ctx.send('Are you sure you want to delete {} messages? (y/n)'.format(number)) + response = await self.bot.wait_for('message', check=author_check) + + if response.content.startswith('y'): + tmp = await ctx.send('Continuing..') + await tmp.delete() + else: + return await ctx.send('Cancelled.') + prefixes = await self.bot.get_prefix(ctx.message) # This returns all server prefixes if isinstance(prefixes, str): prefixes = [prefixes] @@ -283,6 +334,19 @@ class Cleanup: author = ctx.message.author is_bot = self.bot.user.bot + def author_check(message): + return message.author == author + + if number > 100: + await ctx.send('Are you sure you want to delete {} messages? (y/n)'.format(number)) + response = await self.bot.wait_for('message', check=author_check) + + if response.content.startswith('y'): + tmp = await ctx.send('Continuing..') + await tmp.delete() + else: + return await ctx.send('Cancelled.') + # You can always delete your own messages, this is needed to purge can_mass_purge = False if type(author) is discord.Member: