Skip to content

Can't get any of this to work. #1022

Answered by almeidx
steerbjorn asked this question in Q&A
Discussion options

You must be logged in to vote

You're not executing the commands on the interactionCreate listener.

Given that you're attaching a commands property to your client, you can do something like this (replace the contents of your interactionCreate.js file with this):

module.exports = {
	name: 'interactionCreate',
	execute(interaction) {
		console.log(`${interaction.user.tag} in #${interaction.channel.name} triggered an interaction.`);

        if (interaction.isCommand()) {
          const command = interaction.client.commands.get(interaction.commandName);
          command?.execute(interaction);
        }
	},
};

Replies: 5 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@BenjammingKirby
Comment options

@steerbjorn
Comment options

@BenjammingKirby
Comment options

@steerbjorn
Comment options

Comment options

You must be logged in to vote
1 reply
@steerbjorn
Comment options

Comment options

You must be logged in to vote
3 replies
@steerbjorn
Comment options

@almeidx
Comment options

@steerbjorn
Comment options

Answer selected by steerbjorn
Comment options

You must be logged in to vote
2 replies
@monbrey
Comment options

@steerbjorn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants