4

I have a Discord bot and I want it to direct someone to a different channel if they use the trigger word(s). I know I'm probably missing a line or two of code to do it.

bot.on("message", message => {
    if(message.content.toLowerCase().indexOf('lists') > -1) {
        message.channel.send(`Please visit #bt-updates for information on the current list information!`);
    }
});
Jack Bashford
  • 43,180
  • 11
  • 50
  • 79
jordb22
  • 51
  • 1
  • 3
  • 1
    Possible duplicate of [How do I get a bot to mention a channel?](https://stackoverflow.com/questions/49353929/how-do-i-get-a-bot-to-mention-a-channel) – robert Dec 17 '18 at 05:08
  • I had tried that and it doesn't work. – jordb22 Dec 17 '18 at 18:05

3 Answers3

4

Based on your response to HolyDragon, it seems you're looking for how to give the "blue link" for the channel in your response?

If so, you need the channel id for #bt-updates, and to return it as

bot.on("message", message => {
  if(message.content.toLowerCase() === 'lists') {
    message.channel.send(`Please visit <#${id}> for information on the current list information!`);
  }
});
Melmsie
  • 196
  • 1
  • 1
  • 12
-1

Try using === instead of indexOf().

bot.on("message", message => {
    if(message.content.toLowerCase() === 'lists') {
        message.channel.send(`Please visit #bt-updates for information on the current list information!`);
    }
});

Official example for Ping.

holydragon
  • 6,158
  • 6
  • 39
  • 62
-1

let room1 = message.channel.guild.channels.find('id', 'ChannelID'); message.channel.send(Please visit ${room1} for information on the current list information!); }

jordb22
  • 51
  • 1
  • 3