Python 3.x 如何在用户发送命令消息后将其删除
我需要机器人删除作者的消息,一旦命令被发送Python 3.x 如何在用户发送命令消息后将其删除,python-3.x,discord,discord.py,discord.py-rewrite,Python 3.x,Discord,Discord.py,Discord.py Rewrite,我需要机器人删除作者的消息,一旦命令被发送 @commands.command() async def dolor(self,ctx): await client.delete.message(ctx.message) await ctx.send(f"from {ctx.author.name}") await ctx.send("https://tenor.com/view/baby-sad-omg
@commands.command()
async def dolor(self,ctx):
await client.delete.message(ctx.message)
await ctx.send(f"from {ctx.author.name}")
await ctx.send("https://tenor.com/view/baby-sad-omg-desolated-devastated-gif-9710732")
没有所谓的
client.delete.message()
。要删除邮件,需要使用discord.message
对象中的方法
ctx.message
将为您提供discord.message
对象的实例
因此,您的命令如下所示:
@commands.command()
异步def dolor(自身,ctx):
等待ctx.send(f“from{ctx.author.name}”)
等待ctx发送(“https://tenor.com/view/baby-sad-omg-desolated-devastated-gif-9710732")
等待ctx.message.delete()