【问题标题】:how to delete user input command after reply回复后如何删除用户输入的命令
【发布时间】:2018-12-01 16:21:28
【问题描述】:

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

示例:在机器人回复 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)

【问题讨论】:

    标签: python python-3.x discord discord.py


    【解决方案1】:

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

    await bot.delete_message(ctx.message)
    

    【讨论】:

      猜你喜欢
      • 2021-07-17
      • 1970-01-01
      • 2020-09-25
      • 2021-10-13
      • 1970-01-01
      • 2021-02-08
      • 1970-01-01
      • 2013-05-26
      • 2011-01-22
      相关资源
      最近更新 更多