Something about making the game work.

This commit is contained in:
Alex 2020-08-03 19:31:55 -05:00
parent 66fbc34df6
commit 27644de634

View File

@ -65,7 +65,7 @@ client.on('message', async message => {
console.error('Something went wrong', err) console.error('Something went wrong', err)
}) })
message.awaitReactions(filter, {max: 25, time: 60000, errors: ['time']}) message.awaitReactions((reaction) => reaction.emoji.id === config.emoteID, {max: 25, time: 60000, errors: ['time']})
.then(collected => { .then(collected => {
const reaction = collected.first(); const reaction = collected.first();
if (reaction.emoji === emote) { if (reaction.emoji === emote) {
@ -80,11 +80,7 @@ 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. // This will start passing the ball
//This will start passing the ball
function ball(message) { function ball(message) {
message.reply(`${emote} ${value}`) message.reply(`${emote} ${value}`)
.then(() => { .then(() => {
@ -96,15 +92,19 @@ client.on('message', async message => {
}) })
} }
message.reply("Let's start!").then(() => { // This starts the game I guess
}) setTimeout(function () {
message.awaitReactions(filter, {max: 1, time: 30000, errors: ['time']}) message.reply("Let's start!").then(message => {
.then(collected => { message.react(config.emoteID)
const reaction = collected.first(); message.awaitReactions((reaction, user) => user.id === message.member.id && reaction.emoji.id === config.emoteID, { max: 1, time: 30000 })
if (reaction.emoji === client.emojis.cache.get(config.emoteID)) { .then( collected => {
if (collected.first().emoji.id === config.emoteID) {
ball()
}
})
}
}) })
}, 10000)
} }
}); });