Hello guys, I'm working on a custom bot for Discord and I need some help. I have the following code: if(command === 'sino') { if (msg.channel.id === '761500739842506774') { msg.react(":thumbsup:") msg.channel.send("", { files: ["https://image.png"], }); }} Code (markup): I think I'm doing something wrong with the if. What I want is to use the command !sino only on a specific channel. I also have tried this but without success: if(command === 'sino') { msg.channel.id === '761500739842506774' { msg.react(":thumbsup:") msg.channel.send("", { files: ["https://image.png"], }); }} Code (markup): Can someone please help me? Thank you!
Did you try && if(command === 'sino' && msg.channel.id === '761500739842506774') { msg.react(":thumbsup:") msg.channel.send("", { files: ["https://image.png"], }); } Code (markup):
I think this part is the problem. if (msg.channel.id === '761500739842506774' ) You are using a strict equality check. I am thinking "id" is holding an integer, but '761500739842506774' is a string, so comparison is failing the equality check. Try one of these: if (msg.channel.id === 761500739842506774 ) or this: if (msg.channel.id == '761500739842506774' )