Well, this problem has been bothering me for some time now, and I’ve kept putting it off, but now it’s time to get rid of this error.
I am trying to add some users to an array, in a way that makes it easy to just pull them forth and used them as mentions. Right now I have a reaction collector, and I’'m trying to pull out the users from there with two exceptions; the user and the bot. The reason the user isn’t going to matter, is because they should already be a part of the array.
For some context, I’m making a racing game, where you join by reacting and then after 60 seconds the game start and you hope to win. I’ve made a collector using the example on the Collectors | Discord.js Guide-site, but whenever I try to get the user who sent the message, and only the one who sent the message just then (Because the bot appears for every time I log reaction.users
, even though it only reacts once). I’ve tried logging user
, reaction.user
, users
and reaction.users
.
And also, the collected.size
gave me -1
Edit: Forgot to add some referencing code, but here you go
players.push(message.author)
message.channel.send(track).then(sentEmbed => {
sentEmbed.react(car)
const filter = (reaction, user) => {
return reaction.emoji.name === ‘’;
};
const collector = sentEmbed.createReactionCollector(filter, { time: 15000 });
collector.on(‘collect’, (reaction => {
console.log(user)
console.log("\n\n\n")
}));
collector.on(‘end’, collected => {
let track = new Discord.RichEmbed()
.setTitle(“Owned by the Monimuffin Server”)
.setAuthor(“Formuffina 1”, “https://cdn.glitch.com/bdd2abbd-8294-4499-912d-00f9d20e3a1e%2Fa_cf72f7bf4419755aefe87ac271108514.gif?v=1571297404455”)
.setColor(0xffffff)
.setDescription(“It’s a beautiful day outside. Birds are singing, flowers are blooming… \n We are here on the Monimuffin racing track, Sponsored by the Monimuffin server!”)
.setImage(‘https://cdn.glitch.com/bdd2abbd-8294-4499-912d-00f9d20e3a1e%2FSS-Tracks-Concession.png?v=1571439489377’)
.addBlankField()
.addField(“Instructions”, “Attend the race by reacting with” + car + “\nDepending on your car, you have a varying chance of success\nThis is a very dangerous race, and many will not finish\n Only those who manage to finish the race will be rewarded”)
.setFooter(“Current players: 1”);
sentEmbed.edit(track)
})}
Anyways, all help would be greatly appreciated. So as always, thanks in advance, and have a marvelous day!