【问题标题】:Discord - Bot commands not working in "channel threads" featureDiscord - Bot 命令在“通道线程”功能中不起作用
【发布时间】:2021-12-07 22:01:31
【问题描述】:

我的机器人在通道线程中执行时没有检测/响应命令,我该如何解决?

当我在谷歌上搜索这个时,它认为我在要求多线程编程。

@client.command()
@commands.has_role(DEVELOPER_ROLE)
async def debug(ctx):
    print('my code')

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    await client.process_commands(message)

【问题讨论】:

  • 你有与错误相关的代码吗?
  • 我认为它没有打印任何日志,我已将日志记录设置为 on_command_error
  • 你有什么最小的、可重复的例子可以给我们看吗?如果没有看到您首先尝试过的东西,我们无法给您答案。请访问如何寻求进一步的帮助。祝你好运:)
  • @Arghadip,我和他们不和,发现确实是v2.0。目前master有代码。
  • 你可以使用pip install -U git+https://github.com/Rapptz/discord.py通过pip安装它,它相当稳定是的。但是这里列出了一些重大更改:gist.github.com/apple502j/f75b4f24652f04de85c7084ffd73ec58

标签: python discord discord.py


【解决方案1】:

discord.py 的 PyPi 版本仅更新到版本 1.7.3。但是,discord.py 仅在 2.0 主要更新中添加了对线程的支持。要更新到此版本,请执行以下操作:

pip install -U git+https://github.com/Rapptz/discord.py@master

考虑到更新带来了许多重大更改,并且不再维护 discord.py,也许考虑切换到流行的分支之一以接收未来的错误修复和新功能。

【讨论】:

    猜你喜欢
    • 2020-08-16
    • 2021-01-05
    • 2020-08-07
    • 2021-01-02
    • 1970-01-01
    • 2021-05-26
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多