无法读取属性';角色';未定义discord.js v12的
我希望机器人给反应者一个角色。但它不起作用。有人知道问题出在哪里吗?discord.js v12中的Im编码无法读取属性';角色';未定义discord.js v12的,discord.js,Discord.js,我希望机器人给反应者一个角色。但它不起作用。有人知道问题出在哪里吗?discord.js v12中的Im编码 if (user.bot) return; if (reaction.message.partial) await reaction.message.fetch(); if (reaction.partial) await reaction.fetch(); if (user.bot) return; if (!reaction.message.guild) return; if (
if (user.bot) return;
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.guild.id !== "753289194738024632") return;
if (reaction.message.channel.id === "753290581412937832") {
const cs = bot.emojis.cache.find(emoji => emoji.name === "csgo");
const vl = bot.emojis.cache.find(emoji => emoji.name === "valorant");
const fn = bot.emojis.cache.find(emoji => emoji.name === "fortnite");
let role = reaction.guild.roles.cache.find(role => role.id === '753290549548679229');
member.roles.add(role.id);
尝试将
反应
更改为消息
let role=message.guild.roles.cache.find(role=>role.id=='753290549548679229');
我认为
reaction.guild
不是有效的功能尝试将reaction
更改为消息
let role=message.guild.roles.cache.find(role=>role.id=='753290549548679229');
我认为,
reaction.guild
不是一个有效的函数我将其更改为:
if(message.channel.type === 'dm') return message.reply('This command does not work in DMs') //checks if the command wasnt executed in DMs
let role = message.guild.roles.cache.find(role => role.id === '753290549548679229');
我将其改为:
if(message.channel.type === 'dm') return message.reply('This command does not work in DMs') //checks if the command wasnt executed in DMs
let role = message.guild.roles.cache.find(role => role.id === '753290549548679229');
不,它仍然不起作用。控制台给我这个错误:“ReferenceError:message未定义”您没有定义message,您使用的是命令处理程序还是
client.on('message')…
?确保您在消息事件中传递了消息
,然后出现此错误:无法读取未定义的reaction.message.guild的属性“guild”。guild
不工作。控制台给我这个错误:“ReferenceError:message未定义”您没有定义message,您使用的是命令处理程序还是client.on('message')…
?确保您在消息事件中传递的是消息,然后出现此错误:无法读取未定义的反应的属性“guild”。message.guild
确保成员是GuildMember
属性的成员,而不是用户属性确保成员是GuildMember
属性而非用户
属性