我将尽我所能解释这一点,然而,这有点令人困惑.这是我执行斜杠命令的代码.
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction, Servers, Tickets, client);
} catch (error) {
console.error(error);
await interaction.reply({ embeds: [errorEmbed], ephemeral: true });
}
});
如果我把client
放在Servers
之前,它允许我在其他命令中使用它,然而,如果我把它放在Tickets
之后,它就不起作用了.当我将Tickets
或Servers
移到最后时,也会发生这种情况,因为我无法再使用命令中的那些命令.你知道为什么会这样吗?