TypeError:无法读取null的属性“ channels”

时间:2018-11-22 07:55:04

标签: node.js discord.js

由于某种原因,每次我在索引文件中指定的某个通道中运行命令或消息时,控制台都会吐出此错误:TypeError: Cannot read property 'channels' of null

代码如下:

bot.on("message", async message => {
  let schannel = message.guild.channels.find(x => x.name === "suggestions");
  if(message.member.hasPermission("ADMINISTRATOR")) return
  else if(!schannel) return console.log(`There is no suggestions channel!`);;
  if (message.channel != schannel || message.author.bot || message.content.startsWith("!suggest")) return;
  else message.delete().catch(O_o=> {});
});

1 个答案:

答案 0 :(得分:0)

在您要求收集email purchase in 1 hour abc@gmail.com 3 abc@gmail.com 2 def@gmail.com 3 ghi@gmail.com 1 ghi@gmail.com 1 ghi@gmail.com 2 ghi@gmail.com 2 之前,我会尝试检查公会。

.channel