Discord.js block command message in specific channels

Asked

Viewed 1,142 times

0

I would like users to put commands in specific places (in the commandos room) as I can do this, because as I tried it is giving error

client.on('message', message =>{

    const prefix = config.prefix

    if (!message.content.startsWith(prefix) || message.author.bot) return;

    if (message.channel.cache.get() == client.channels.cache.get('787113881197740103')||message.channel.cache.get() == client.channels.cache.get('787060910605991966')){
        message.reply("Vai no canal certo vagabundo!")
        return;
    }

1 answer

-1

Try to do it this way:

client.on('message', message => {
    const prefix = config.prefix
    if (!message.content.startsWith(prefix) || message.author.bot) return;
    if (message.channel.id != 'id do canal de comandos') {
        return message.reply('**Vai no canal certo!**')
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.