discord.py斜杠命令同步失败:执行sync命令后未生效问题排查
Discord机器人斜杠命令同步无效问题
我正在尝试为我的Discord机器人同步所有斜杠命令,但运行sync命令后未生效。
我的client变量创建代码如下:
client = commands.Bot(intents=INTENTS, command_prefix=PREFIX)
同步命令代码:
@client.command() async def sync(ctx): print("sync command") if ctx.author.id == my_id: await client.tree.sync() await ctx.send('Command tree synced.') else: await ctx.send('You must be the owner to use this command!')
运行该命令后我能收到返回消息,说明tree.sync()已执行,但似乎没有效果。请问同步是否需要等待时间,还是代码写法有误?另外,尝试await client.tree.sync(guild=None)也无效。
内容的提问来源于stack exchange,提问作者Zye
相关产品推荐
相关产品推荐

