Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.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 回复后如何删除用户输入命令_Python_Python 3.x_Discord_Discord.py - Fatal编程技术网

Python 回复后如何删除用户输入命令

Python 回复后如何删除用户输入命令,python,python-3.x,discord,discord.py,Python,Python 3.x,Discord,Discord.py,Python Bot在发送回复后未删除用户输入命令。我在最后一行添加了wait bot.delete_message(message),回复后仍然没有删除 示例:在bot回复的Pong之后。它应该删除?ping @bot.command(pass_context=True) async def ping(ctx): msg = "Pong. {0.author.mention}".format(ctx.message) await bot.say(msg) await b

Python Bot在发送回复后未删除用户输入命令。我在最后一行添加了
wait bot.delete_message(message)
,回复后仍然没有删除

示例:在bot回复的
Pong
之后。它应该删除
?ping

@bot.command(pass_context=True)
async def ping(ctx):
    msg = "Pong. {0.author.mention}".format(ctx.message)
    await bot.say(msg)
    await bot.delete_message(message)

您没有变量名
消息
。而是删除调用上下文提供的消息

await bot.delete_message(ctx.message)