【问题标题】:If a specific user is @ then say a phrase如果特定用户是@,则说一个短语
【发布时间】:2021-03-08 22:56:32
【问题描述】:

我想要这样,如果有人 @'s user 1 然后它会回复一个短语 现在发生的情况是,任何人发送的任何消息都会导致机器人发送该短语。

bot.on('message', message => {
    if (message.channel.type != 'text' || message.author.bot) 
      return;

    if (message.content === '<@user_id_1>' || '<@!user_id_1>'){
      message.channel.send(`<@!user_id_1> is funny`)
    }
});

【问题讨论】:

标签: javascript discord discord.js


【解决方案1】:
bot.on('message', message => {
  if (message.channel.type != 'text' || message.author.bot) 
     return;

  if (message.content === '<@user_id_1>' || message.content === '<@!user_id_1>'){
    message.channel.send(`<@!user_id_1> is funny`)
  }
});

【讨论】:

    猜你喜欢
    • 2017-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多