Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
194
rated 0 times [  198] [ 4]  / answers: 1 / hits: 19333  / 6 Years ago, mon, january 29, 2018, 12:00:00

I am owning a Discord.js bot and I can't figure out how to do that :/



I want the users to type the command !help in the #commands channel only.



P.S. I know how to get the channel ID and I have it.



So what should I do in the command event to do that?



Thanks!


More From » node.js

 Answers
220

Use the Message.channel.id property.



Refer to the discord.js documentation for more



client.on('message', msg => {
if (msg.channel.id === 'ChannelID') {
// Deal with command
}
});

[#55325] Friday, January 26, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brendaw

Total Points: 508
Total Questions: 90
Total Answers: 100

Location: Maldives
Member since Sat, Jan 29, 2022
2 Years ago
;