I dont even know where to begin describing this but this is me showing my progress.
This commit is contained in:
parent
93e3af506d
commit
c087908765
77
src/index.js
77
src/index.js
@ -1,19 +1,21 @@
|
|||||||
// Load up the libraries
|
// Load up the libraries
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const prettyMilliseconds = require('pretty-ms');
|
|
||||||
|
|
||||||
// Importing config
|
// Importing config
|
||||||
const config = require('./config.json')
|
const config = require('./config.json')
|
||||||
|
|
||||||
//User array and random user picker
|
//User array and random number
|
||||||
var randomValue = myArray[Math.floor(Math.random() * myArray.length)];
|
let players = [];
|
||||||
var players = []
|
let value = players[Math.floor(Math.random() * players.length)];
|
||||||
var value = players[Math.floor(Math.random() * myArray.length)];
|
|
||||||
|
|
||||||
|
|
||||||
// Create client
|
// Create client
|
||||||
const client = new Discord.Client();
|
const client = new Discord.Client();
|
||||||
|
|
||||||
|
// Filter for filtering out only the beach ball emote
|
||||||
|
const filter = (reaction) => {
|
||||||
|
return reaction.emoji.name === '739737953181630584';
|
||||||
|
};
|
||||||
|
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
//logs when the bot comes online
|
//logs when the bot comes online
|
||||||
console.info(
|
console.info(
|
||||||
@ -30,41 +32,44 @@ client.on('ready', () => {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Collects messages and reactions?
|
|
||||||
const filter = (reaction) => {
|
|
||||||
return reaction.emoji.name === '739737953181630584';
|
|
||||||
};
|
|
||||||
const collector = message.channel.createReactionCollector(filter, { time: 15000 });
|
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on('message', () => {
|
client.on('message', async message => {
|
||||||
if (message.channel === 710574818222931968) {
|
if ((message.channel === 710574818222931968)) return;
|
||||||
//Game function
|
//Game function
|
||||||
if (message.content === '!play') {
|
if (message.content === '!play') {
|
||||||
message.reply("Who wants to play with the beach ball?");
|
message.reply("Who wants to play with the beach ball?").then(() => {
|
||||||
message.react('739737953181630584');
|
message.react('739737953181630584')
|
||||||
// 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'] })
|
.catch((err) => {
|
||||||
.then(collected => {
|
console.error("Something went wrong!", err)
|
||||||
const reaction = collected.first();
|
return message.channel.send("Something went wrong..."
|
||||||
if (reaction.emoji === '739737953181630584') {
|
)
|
||||||
players = reaction.users;
|
}
|
||||||
}
|
)
|
||||||
})
|
;
|
||||||
//This will start passing the ball
|
// going to change this to an on. statement and try making it more "JS" I think I see where you are going.
|
||||||
let ball = message.reply("739737953181630584 <@" + value + ">") + message.react('739774044974481478')
|
message.awaitReactions(filter, {max: 1, time: 60000, errors: ['time']})
|
||||||
|
.then(collected => {
|
||||||
|
const reaction = collected.first();
|
||||||
|
if (reaction.emoji === filter) {
|
||||||
|
players = reaction.users;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//This will start passing the ball
|
||||||
|
let ball = await message.reply("<:BeachBall1:737676787823411230> <@" + value + ">") + message.react('737676787823411230')
|
||||||
|
|
||||||
message.reply("Let's start!")
|
message.reply("Let's start!").then(() => {
|
||||||
message.awaitReactions(filter, { max: 1, time: 30000, errors: ['time'] })
|
})
|
||||||
.then(collected => {
|
message.awaitReactions(filter, {max: 1, time: 30000, errors: ['time']})
|
||||||
const reaction = collected.first();
|
.then(collected => {
|
||||||
if (reaction.emoji === '739774044974481478') {
|
const reaction = collected.first();
|
||||||
|
if (reaction.emoji === message.guild.cache.find(emoji => emoji.id('737676787823411230'))) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(config.token);
|
client.login(config.token);
|
||||||
|
Loading…
Reference in New Issue
Block a user