Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在发送此代码中的响应后,如何删除?Say命令消息?_Python_Discord.py - Fatal编程技术网

Python 在发送此代码中的响应后,如何删除?Say命令消息?

Python 在发送此代码中的响应后,如何删除?Say命令消息?,python,discord.py,Python,Discord.py,我刚刚在我的代码中添加了?say命令,我还希望bot删除我发送的消息 这是say命令: @client.command(aliases = ['Say']) async def say(ctx, *args): response = "" for arg in args: response = response + " " + arg await ctx.channel.send(response) 如果要删除

我刚刚在我的代码中添加了
?say
命令,我还希望bot删除我发送的消息

这是say命令:

@client.command(aliases = ['Say'])
async def say(ctx, *args):
    response = ""

    for arg in args:
        response = response + " " + arg

    await ctx.channel.send(response)

如果要删除为运行命令而发送的消息,可以使用

@client.command(别名=['Say'])
异步定义(ctx,*参数):
response=“”
对于args中的arg:
响应=响应+“”+arg
等待ctx.channel.send(响应)
等待ctx.message.delete()

等待ctx.message.delete()
?你应该编辑你的帖子,以便更清楚地了解你在问什么问题。听起来像是在问:“如何删除
?在发送此代码中的
响应后说
命令消息?”