I've created my own Node.js bot to work in my discord server.
My bot is named mybot
.
I've seen numerous examples of responding to incoming messages - they look like this (and work just fine).
chatroom.on('message', function(msg){
if(msg.content === 'ping'){
msg.reply('pong');
}
});
The code above will have the bot reply with "pong" whenever anyone writes just "ping" in the channel.
As with most bots, generally you speak to them and ask them for something like @mybot blahblahblah
- and then they reply.
I want to do this. I want mybot
to only reply when he is spoken to. There must be a msg.recipientList
or msg.recipients
that captures the @mybot
. I've looked through Discord.js's docs and I'm having a hard time finding this result.