简体   繁体   中英

Discord.js var with username outputs "undefined"

if (message.reactions.size) {
    let reaction = message.reactions.find(r => r._emoji.name == '🎉');
    if (reaction) {
    var winnaar = reaction.users.random;

  }
}

So this is for a discord.js giveaway bot, and what its meant to do is store a random users name who reacted in the "winnaar" (winner in dutch) variable. But when I make the bot send a message containing ${winnaar} it outputs "Undifined". I am quite new to Discord js and I would appreciate any help.

Look at this link Discord random

Here you can see that random is function, try with random(1)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM