所以我尝试用nextcord (python)在cogs中注册一个斜杠命令,它说它已经用bot.load_extension(blahblah(bot)加载了它,但是它没有注册,甚至在DMS中也没有,下面是代码
from nextcord.ext import commands
class Test(commands.Cog):
def __init__(self,bot):
self.bot=bot
guilds = IDOFSERVER
@nextcord.slash_command(name="slashincog",guild_ids=[guilds])
async def slashincog(self, interaction: nextcord.Interaction):
await interaction.response.send_message("Testing")
def setup(bot):
bot.add_cog(Test(bot))加载斜杠命令有什么需要做的吗?我试过很多教程,但似乎都没有用。任何帮助都将不胜感激。
发布于 2022-08-10 04:34:07
下面是Nextcord不和谐服务器的一些建议。#3可能是这里的问题,但如果你还没有解决,你可以看看其他的可能性。
最常见的问题
,
较小的常见问题
bot.add_all_application_commands()和await bot.sync_application_commands()。try:
await bot.sync_application_commands(guild_id=guild.id)
except Forbidden:
passhttps://stackoverflow.com/questions/72761831
复制相似问题