【问题标题】:Have the Discord Bot link another Channel让 Discord Bot 链接另一个频道
【发布时间】:2019-05-17 10:37:31
【问题描述】:

我有一个 Discord 机器人,如果他们使用触发词,我希望它能够将某人引导到不同的频道。我知道我可能缺少一两行代码。

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!`);
    }
});

【问题讨论】:

标签: javascript json bots discord discord.js


【解决方案1】:

尝试使用=== 而不是indexOf()

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

Ping 的官方示例。

【讨论】:

  • 与我的原始代码做同样的事情。不链接消息中的#bt-updates
【解决方案2】:

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

【讨论】:

    【解决方案3】:

    根据您对 HolyDragon 的回复,您似乎正在寻找如何在回复中为频道提供“蓝色链接”?

    如果是这样,您需要 #bt-updates 的频道 ID,并将其返回为

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

    【讨论】:

      猜你喜欢
      • 2020-07-13
      • 2020-03-12
      • 2020-07-14
      • 2018-11-24
      • 2019-05-05
      • 2019-08-12
      • 2021-02-26
      • 1970-01-01
      • 2020-11-04
      相关资源
      最近更新 更多