Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 让Discord Bot链接另一个频道_Javascript_Json_Bots_Discord_Discord.js - Fatal编程技术网

Javascript 让Discord Bot链接另一个频道

Javascript 让Discord Bot链接另一个频道,javascript,json,bots,discord,discord.js,Javascript,Json,Bots,Discord,Discord.js,我有一个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 inf

我有一个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!`);
    }
});

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


官方示例。

让room1=message.channel.guild.channels.find('id','ChannelID') message.channel.send(
请访问${room1}了解当前列表信息!
);
}

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

如果是,您需要#bt更新的频道id,并以

bot.on("message", message => {
  if(message.content.toLowerCase() === 'lists') {
    message.channel.send(`Please visit <#${id}> for information on the current list information!`);
  }
});
bot.on(“消息”,消息=>{
if(message.content.toLowerCase()=='lists'){
message.channel.send(`请访问以获取当前列表信息!`);
}
});

执行与我的原始代码相同的操作。没有链接消息中的#bt更新可能重复我尝试过的,但它不起作用。
bot.on("message", message => {
  if(message.content.toLowerCase() === 'lists') {
    message.channel.send(`Please visit <#${id}> for information on the current list information!`);
  }
});