【问题标题】:Do sub commands in discord.py command groups inherit decorators of the parent command?discord.py 命令组中的子命令是否继承父命令的装饰器?
【发布时间】:2021-11-05 18:19:58
【问题描述】:

我正在尝试在 discord.py 中执行一系列命令,其中父命令为“set”,子命令为“channel”或其他一些组/命令。正如您可能猜到的那样,我不希望任何人都能够设置欢迎或再见频道。所以我的问题是:如果我有这个代码......

@bot.group()
@has_permissions(manage_server=True)
async def set():
  # enter command functionality here

...我在该组中创建一个子命令/组...

@set.group()
async def channel():
  # enter command functionality here

...权限会被子组/命令继承吗?

【问题讨论】:

  • 是的,权限也会在子命令中继承。

标签: python discord discord.py


【解决方案1】:

是的,权限是从装饰器继承的。

【讨论】:

    猜你喜欢
    • 2021-03-26
    • 2020-07-15
    • 1970-01-01
    • 2018-12-30
    • 2021-01-12
    • 2021-07-24
    • 2021-05-23
    • 2022-01-17
    • 2022-01-07
    相关资源
    最近更新 更多