【问题标题】:how I can to reply to message with my discord bot?如何使用我的不和谐机器人回复消息?
【发布时间】:2021-04-10 23:44:42
【问题描述】:

我正在尝试回复与我的机器人不一致的消息,但我不明白如何。
我看了一些答案,但我没有得到答案。有人说我需要写这段代码:
await message.reply('Hello!', mention_author=True)

但它不起作用,我收到一个错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'reply'

请帮助我!

【问题讨论】:

  • Discord.py 每两周更改一次 API。您查看的教程可能已过时。我认为您现在必须在所有命令中使用 context 参数,并且可能缺少第一个参数。如果您的命令现在称为def example(msg),请尝试将其称为def example(ctx, msg)

标签: python discord discord.py


【解决方案1】:

从官方discord.py github看这个例子 https://github.com/Rapptz/discord.py/blob/master/examples/reply.py

【讨论】:

  • 感谢您的帮助!
猜你喜欢
  • 2021-03-05
  • 1970-01-01
  • 2022-01-09
  • 2018-11-19
  • 2021-07-25
  • 1970-01-01
  • 2021-05-07
  • 2021-02-19
  • 1970-01-01
相关资源
最近更新 更多