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)
|
await ctx.channel.purge(limit=int(count), check=is_me)
|
||||||
|
|
||||||
response = await ctx.respond("ok")
|
await ctx.respond("ok", delete_after=2)
|
||||||
await response.delete()
|
|
||||||
|
|
||||||
@commands.command(name="cleanup")
|
@commands.slash_command(
|
||||||
async def cleanup(self, ctx: commands.Context):
|
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):
|
def is_discord_bot(m):
|
||||||
return m.author == self.bot.user
|
return m.author == self.bot.user
|
||||||
|
|
||||||
num = 20
|
await ctx.channel.purge(limit=count, check=is_discord_bot)
|
||||||
if len(ctx.message.content.split()) > 1:
|
await ctx.respond("ok", delete_after=2)
|
||||||
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()
|
|
||||||
|
|
||||||
@commands.command(name="shoo")
|
@commands.command(name="shoo")
|
||||||
async def shoo(self, ctx: commands.Context):
|
async def shoo(self, ctx: commands.Context):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user