mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
[V3] Add prompt if message deletion > 100 (#1304)
* Add prompt if message deletion > 100 As per issue #1295. Add's the prompt "Are you sure you want to delete {number} messages? (y/n)" * added checks and deletes "Continuing" message phew * removed unneeded delete() Removed the unneeded code
This commit is contained in:
parent
b871241eac
commit
d2e841f681
@ -42,6 +42,19 @@ 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.')
|
||||
|
||||
def check(m):
|
||||
if text in m.content:
|
||||
return True
|
||||
@ -91,6 +104,19 @@ 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.')
|
||||
|
||||
def check(m):
|
||||
if isinstance(user, discord.Member) and m.author == user:
|
||||
return True
|
||||
@ -186,8 +212,20 @@ class Cleanup:
|
||||
|
||||
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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user