我正在尝试让对邮件做出反应的用户扮演角色。在其中我面临一些问题。 我无法获得用户的ID或用户名。请在下面找到代码:
let suser = message.member;
const filterv = (reaction, userv) => reaction.emoji.name === '✅' && userv.id != suser.id && userv.id != "692755575418650654"
m.awaitReactions(filterv, {max: 1})
.then(cc => {
console.log(cc.forEach((reaction => reaction.users.forEach(console.log))))
m.delete()
})
.catch(console.log);
以上代码返回undefined
我应该怎么做而不是
console.log(cc.forEach((reaction => reaction.users.forEach(console.log))))
从地图上获取ID
users:
Collection [Map] {
},
'681898825463627866' => User {
id: '681898825463627866',
username: 'ayetest',
discriminator: '2219',
avatar: null,
bot: false,
lastMessageID: null,
lastMessage: null
}
}
我正在尝试执行以下操作(如下代码),但是无法从集合中获取用户,但是未定义userv
let srole = message.mentions.roles.first() || message.guild.roles.find(r => r.name === args[0])
let suser = message.member;
const filterv = (reaction, userv) => reaction.emoji.name === ':white_check_mark:' && userv.id != suser.id && userv.id != "692755575418650654"
m.awaitReactions(filterv, {max: 1})
.then(collection => {
userv.addRole(srole.id)
m.delete()
})
.catch(console.log);