the part of my code
const emodjimessage = await message.channel.send(duelrequest)
emodjimessage.react("⛔")
emodjimessage.awaitReactions({max: 1, time: 90000, errors: ["time"]}).then(collected => {
const reaction = collected.first();
switch (reaction.emoji.name) {
case "⛔":
// some code here
break
}
})
Hello, i want to get id of the user who reacted to the message first, but i have no idea, how to do this
The awaitReactions()
method will return a collection of reaction objects, so you can do collected.first()
to get the first one, as you have done.
From here, you can get the user and their ID like so
let firstReaction = collection.first();
let firstUser = firstReaction.user;
let firstUserId = firstUser.id;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.