【问题标题】:Command groups (subcommands) using discord.py while using cogs在使用 cogs 时使用 discord.py 的命令组(子命令)
【发布时间】:2021-07-24 20:09:03
【问题描述】:

在使用 cogs 时如何在 discord.py 中使用命令组(子命令)?会不会和平时一样?不使用齿轮的正常含义?还是我必须做一些额外的事情。我查看了 discord.py 文档,但似乎找不到任何东西。如果有人可以向我展示如何使用带有 cogs 的命令组的示例,那就太好了。

我尝试了以下方法:

#This is in a cog
@bot.group(pass_context=True)

但我的代码 linter 一直说 bot 未定义。

当我尝试时:

#This is in a cog
@self.bot.group(pass_context=True)

它说的自我是未定义的。

【问题讨论】:

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


    【解决方案1】:

    在 cog 中,不要使用机器人,而是使用命令。 例如

    @commands.group(pass_context=True)
    

    【讨论】:

      猜你喜欢
      • 2022-01-07
      • 1970-01-01
      • 1970-01-01
      • 2020-07-15
      • 2021-03-26
      • 2020-03-07
      • 2021-11-05
      • 1970-01-01
      • 2021-09-06
      相关资源
      最近更新 更多