Making the bot collect reactions from said message
This commit is contained in:
parent
be9a4f81f3
commit
66fbc34df6
19
src/index.js
19
src/index.js
@ -59,10 +59,19 @@ client.on('message', async message => {
|
|||||||
|
|
||||||
message.channel.send("Who wants to play with the beach ball?")
|
message.channel.send("Who wants to play with the beach ball?")
|
||||||
.then(message => {
|
.then(message => {
|
||||||
|
// Reacts to its own message
|
||||||
message.react(config.emoteID)
|
message.react(config.emoteID)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error('Something went wrong', err)
|
console.error('Something went wrong', err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
message.awaitReactions(filter, {max: 25, time: 60000, errors: ['time']})
|
||||||
|
.then(collected => {
|
||||||
|
const reaction = collected.first();
|
||||||
|
if (reaction.emoji === emote) {
|
||||||
|
players = reaction.users;
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error("Something went wrong!", err)
|
console.error("Something went wrong!", err)
|
||||||
@ -70,15 +79,9 @@ client.on('message', async message => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
;
|
|
||||||
// going to change this to an on. statement and try making it more "JS" I think I see where you are going.
|
// going to change this to an on. statement and try making it more "JS" I think I see where you are going.
|
||||||
message.awaitReactions(filter, {max: 1, time: 60000, errors: ['time']})
|
|
||||||
.then(collected => {
|
|
||||||
const reaction = collected.first();
|
|
||||||
if (reaction.emoji === emote) {
|
|
||||||
players = reaction.users;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
//This will start passing the ball
|
//This will start passing the ball
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user