Reputation: 331
If the command was executed in wrong channel bot should detect it and return message.reply("wrong channel")
With code below, I want to make bots channel
be the main channel for a bot to run its commands
Code:
if(!message.guild.channels.cache.find(channel => channel.name === "bots")) return message.reply("wrong channel")
Code is not working.
Upvotes: 0
Views: 236
Reputation: 331
I managed to find an issue and fix it.
Old code:
if(!message.guild.channels.cache.find(channel => channel.name === "bots")) return message.reply("wrong channel")
New Code:
var ChannelName = message.channel.name
if(ChannelName !== "bots") return message.reply("wrong channel")
Hopefully this helps.
Upvotes: 1