繁体   English   中英

Pycord:斜杠命令与斜杠命令组共享名称?

[英]Pycord: Slash command sharing a name with a slash command group?

有没有办法让斜杠命令与斜杠命令组共享名称? 我希望能够有一个命令/settings来列出当前设置,但也有像/settings offset/settings channel这样的命令来改变这些设置。

我目前有一个齿轮

    @commands.slash_command()
    async def settings(self, ctx: discord.ApplicationContext):
        """See the settings for this server"""

    settings_group = discord.commands.SlashCommandGroup("settings", "Change the settings for this server")

    @settings_group.command()
    async def offset(self, ctx: discord.ApplicationContext, offset: int):
        """Set the UTC offset for this server"""

    @settings_group.command()
    async def channel(self, ctx: discord.ApplicationContext, channel):
        """Set the reminder channel for this server"""

但是尝试使用此 cog 运行机器人会出现错误

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 4: Application command names must be unique

有没有办法使用 Pycord 解决这个问题? 谢谢!

这是一个不和谐的限制

目前,由于 Discord 限制,无法在 Slash 命令组中调用基本命令。 因此,这也将转化为错误请求错误。

使用子命令或子命令组将使您的基本命令无法使用。 如果您还有 /permissions add | 则不能将基本 /permissions 命令作为有效命令发送。 作为子命令或子命令组删除

文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM