Discord.js v12问题与反应消息

Discord.js v12问题与反应消息,discord.js,Discord.js,我正试图发出一条信息,用户将对此作出反应并获得一个角色。我收到一个错误无法读取未定义的属性“cache”。定义了channelid,并定义了角色名称 我的代码: if(blueroleID !== 0) { if (reaction.message.partial) await reaction.message.fetch(); if (reaction.partial) await reaction.fetch(); if(user.bot) return;

我正试图发出一条信息,用户将对此作出反应并获得一个角色。我收到一个错误
无法读取未定义的属性“cache”
。定义了channelid,并定义了角色名称

我的代码:

    if(blueroleID !== 0) {
    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.channel.id === channelid){}
    if (reaction.emoji.name === "The 
discord.js
Message
class doesn't have a
members
attribute. But the
User
object from the second argument of the event listener can be used instead. It is a user object, but can be resolved to a
GuildMember
object using
Guild.member(User)
. So, you can use the following code:

await reaction.message.guild.member(user).roles.add(rolename)
if(blueroleID!==0){
if(reaction.message.partial)等待reaction.message.fetch();
if(reaction.partial)等待reaction.fetch();
if(user.bot)返回;
如果(!reaction.message.guild)返回;
如果(reaction.message.channel.id===channelid){}

if(reaction.emoji.name==”则
discord.js
消息
类没有
成员
属性。但是可以使用事件侦听器第二个参数中的
用户
对象。它是一个用户对象,但可以使用
帮会成员(用户)解析为
帮会成员
对象
。因此,您可以使用以下代码:

wait reaction.message.guild.member(user.roles.add(rolename)

discord.js
Message
类没有
members
属性。但是可以使用事件侦听器第二个参数中的
User
对象。它是一个用户对象,但可以使用
Guild.member(用户)解析为
GuildMember
对象
。因此,您可以使用以下代码:

wait reaction.message.guild.member(user.roles.add(rolename)

每条消息只有一个
成员
——消息的作者。也许您打算改用
反应。用户。缓存
?每条消息只有一个
成员
——消息的作者。也许您打算改用
反应。用户。缓存