我有一个机器人,如果您在非命令通道中使用命令,它会发送一条消息,它会告诉您仅在正确的通道中使用命令,但我希望它不会影响具有员工角色的人员,这是我得到的代码这个错误TypeError: Cannot read property 'roles' of null 我的代码:
client.on('message', message => {
if(!message.member.roles.cache.has(784236433975541771)) {
if (message.content.startsWith("-")) {
if (message.channel.id === '759066524605612108') return;
if (message.channel.id === '775035651640918067') return;
if (message.channel.id === '777287305580511262') return;
message.channel.send('You have been pinged in the <#759066524605612108> channel with the results to your command. Please only use commands there.');
}else
if (message.content.startsWith("!")) {
if (message.channel.id === '759066524605612108') return;
if (message.channel.id === '775035651640918067') return;
if (message.channel.id === '777287305580511262') return;
message.channel.send('Rank has been disabled in this channel. Please only use commands in the <#759066524605612108> channel.');
}
}
});
我正在尝试这样做是discord.js v12
qq_笑_17
江户川乱折腾
相关分类