Fixing the purge and cleanup commands
This commit is contained in:
parent
f5acce0362
commit
fc78522ad3
@ -185,28 +185,24 @@ class ServerUtils(commands.Cog):
|
||||
|
||||
await ctx.channel.purge(limit=int(count), check=is_me)
|
||||
|
||||
response = await ctx.respond("ok")
|
||||
await response.delete()
|
||||
await ctx.respond("ok", delete_after=2)
|
||||
|
||||
@commands.command(name="cleanup")
|
||||
async def cleanup(self, ctx: commands.Context):
|
||||
@commands.slash_command(
|
||||
guild_ids=None, name="cleanup", description="cleanup bot messages"
|
||||
)
|
||||
@commands.has_role("ADMIN")
|
||||
@option(
|
||||
name="count",
|
||||
description="The count to delete",
|
||||
default=3,
|
||||
required=True,
|
||||
)
|
||||
async def cleanup(self, ctx: commands.Context, count):
|
||||
def is_discord_bot(m):
|
||||
return m.author == self.bot.user
|
||||
|
||||
num = 20
|
||||
if len(ctx.message.content.split()) > 1:
|
||||
try:
|
||||
num = int(ctx.message.content.split()[1]) + 1
|
||||
except ValueError:
|
||||
await ctx.send(
|
||||
ctx.message.channel,
|
||||
"You need to give me a number, you entered {}".format(
|
||||
ctx.message.content.split()[1]
|
||||
),
|
||||
)
|
||||
return
|
||||
await ctx.message.channel.purge(limit=num, check=is_discord_bot)
|
||||
await ctx.message.delete()
|
||||
await ctx.channel.purge(limit=count, check=is_discord_bot)
|
||||
await ctx.respond("ok", delete_after=2)
|
||||
|
||||
@commands.command(name="shoo")
|
||||
async def shoo(self, ctx: commands.Context):
|
||||
|
Loading…
x
Reference in New Issue
Block a user