client.ws.on('INTERACTION_CREATE', async (interaction) => {}
The interaction class has lots of properties like channel, member and id but it doesn't have a message property.
Is there a way to get the message from an interaction or will I have to use a event listener on message? And if so, how would I use this with slash commands?
You can get the user input by just using the base class interaction. However, the content is not visible, but you can view it by passing it through an api endpoint or something similar, its kind of weird for me but i'm sure there is an explanation for that.
The best way is to use interaction.options, so you'll need to add at least one option in your application command.
For example
// /test as your Application command
client.on('interactionCreate', async interaction => {
if (interaction.commandName === 'test') {
const message = interaction.options.data
console.log(message)
})
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With