我如何将斜杠命令推送到机器人当前所在的所有行会?

How would I push slash commands to all the guilds the bot currently is in?

我知道这里有很多关于这个问题的答案,但 none 适合我正在使用的命令处理程序。 谁能告诉我如何将我的斜杠命令注册到我的机器人所在的所有行会? 点击here获取代码

您当前的密码是

 client.on('ready', async () => {
        const TestGuild = await client.guilds.cache.get('928297578691432480');
        TestGuild.commands.set(commandsArray)
    });

您正在访问 GuildApplicationCommandManager, you need to access the ApplicationCommandManager directly available to your Client at ClientApplication#commands 因此一个简单的更改看起来像这样:

client.application.commands.set(commandsArray)