The title says all. I'm making a Discord bot in node.js, and one part that I'm trying to add is a .setup
command, to make the bot less dependent on manually changing the value of client.channels.get().send()
, allowing it to be more easily set up in the future.
Anyway, in my case, I'm trying to have the user reply to a message with a channel mention (like #welcome for example), and have the bot return that ID and save it to a variable.
Currently, I have this:
function setupChannel() {
client.channels.get(setupChannelID).send('Alright. What channel would you like me to send my reminders to?');
client.on('message', message => {
checkChannel = message.mentions.channels.first().id;
client.channels.get(setupChannelID).send('Ok. I\'ll send my reminders to that channel.');
});
}
message.mentions.channels
returns undefined.
I know that the message.mentions.channels.first().id
bit works when its a user instead of a channel, is there a different way of getting a channel mention in a message?
message.mentions.channels.first().id
should work – Gilles Heinesch