我不知道为什么不清除它可能只是我很愚蠢,但是如果有人指出这一点,那将非常感谢
@client.command(aliases=["clean"])
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount: int):
authors = {}
async for message in ctx.channel.history(limit=amount + 1):
if message.author not in authors:
authors[message.author] = 1
else:
authors[message.author] += 1
message.delete()
msg = "\n".join([f"{author}:{amount}" for author, amount in authors.items()])
await ctx.channel.send(msg)
答案 0 :(得分:0)
感谢Benjin和PaxxPatriot,现在它的工作对于清除命令来说有点慢,但是却需要做些什么
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount: int):
authors = {}
async for message in ctx.channel.history(limit=amount + 1):
if message.author not in authors:
authors[message.author] = 1
else:
authors[message.author] += 1
await message.delete()
msg = "\n".join([f"{author}:{amount}" for author,
amount in authors.items()])
await ctx.channel.send(msg)```