[英]Adding a purge command in a discord bot using python
如何在我的机器人中添加清除命令? 这是我绝望的代码,当然不起作用,机器人没有响应
@client.command()
async def sc(ctx):
await ctx.channel.purge
await ctx.channel.send("Thank you for choosing the wheat farms")
我的目的是让机器人在收到命令“/sc”后清除整个频道
清除所有消息是不可能的,因此通过对频道进行核对,您可以获得相同的结果。
享受!
@client.command()
async def sc(ctx):
channel=ctx.channel
new_channel = await channel.clone(reason=".")
await channel.delete()
await new_channel.send("Thank you for choosing the wheat farms")
如果这不是你想要的,你可以查看这个python Discord.py delete all messages in a text channel
但我还是更喜欢这种方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.