使用 nextcord 在 Cogs 中创建/命令?

Create / Commands in Cogs with nextcord?

我不确定我是否做错了,但我必须等待一段时间才能显示命令

@slash_command(name="somename", description="somediscription", guild_ids=[id])
async def verify(self, interaction:Interaction):
pass

(这是我的第一个 Whosebug post 如果我做的不完全正确,我很抱歉)

使用以下命令下载斜杠命令的更新版本:
pip uninstall nextcord
pip install git+https://github.com/alentoghostflame/nextcord@slash_fixes

然后在 bot.load_extension 下面添加此代码,无论您在哪里加载 cog:

for guild_id in TESTING_GUILD_IDS:
    guild = bot.get_guild(guild_id)
    await guild.rollout_application_commands()

其中 TESTING_GUILD_IDS 是您的公会 ID 列表。