I will try to explain this the best I can, however, it is a little confusing. Here is my code for executing a slash command.
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 });
}
});
If I put client right before Servers, it allows me to use it in other commands, however, if I put it later such as after Tickets, it doesn't work. This also happens when I move Tickets or Servers to the end I can no longer use those in the commands. Any ideas on why this could be?