Python Discord.py清除命令中的人员列表和已删除邮件数
你知道怎么做那样的事吗?我指的是人员列表和已删除邮件的数量:Python Discord.py清除命令中的人员列表和已删除邮件数,python,bots,discord,discord.py,Python,Bots,Discord,Discord.py,你知道怎么做那样的事吗?我指的是人员列表和已删除邮件的数量: (来源:) @bot.command(别名=[“清除”]) @commands.has_权限(manage_messages=True) 异步def清除(ctx,金额:整数): 等待ctx通道净化(限制=数量+1) embed=discord.embed(title=f“`{amount}`消息已被删除。”,description=“”,color=0xff0000) 等待ctx.send(嵌入=嵌入,删除\u后=2) 您可以迭代而
(来源:)
@bot.command(别名=[“清除”])
@commands.has_权限(manage_messages=True)
异步def清除(ctx,金额:整数):
等待ctx通道净化(限制=数量+1)
embed=discord.embed(title=f“`{amount}`消息已被删除。”,description=“”,color=0xff0000)
等待ctx.send(嵌入=嵌入,删除\u后=2)
您可以迭代而不是使用清除,例如:
@bot.command(aliases=["purge"])
@commands.has_permissions(manage_messages=True)
async def clear(ctx, amount: int):
authors = {}
async for message in ctx.channel.history(limit=amount):
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)
@Qbiczeq ty,应该是这样吗