-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
55 lines (44 loc) · 1.88 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//FIXME: odd player count off-by-one + voting for players
require('dotenv').config()
const { Client, Intents} = require('discord.js');
const fs = require('fs');
const CLIENT = new Client({ intents: [Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILDS, Intents.FLAGS.DIRECT_MESSAGES, 'GUILD_VOICE_STATES'] });
CLIENT.login(process.env.BOT_TOKEN)
//data///////////////////////////////////////////////////////////////////////////////////////////////////////
const CONTENT_DATA = {
includedLanguages: ["en", "de", "ru"]
}
const GUILD_DATA = {
serverID: ""
}
var config = {
language: 'de', //ISO language code
playerCount: 2, //players needed until reimhard starts the game
countdown: 60, //in seconds
rounds: 1, //how many prompts are send to each user
voteTime: 30 //in seconds
}
var gameData = {
usersPlaying: [], //arr of all Discord user Objects that are playing
userRoundData: [], //arr of round-specific data [player:{discord.user}, prompt1:string, prompt2:string, entry1:string, entry2:string, promptCompleted:bool, votes:int, votingCompleted: bool, opponent{discord.user/reimhard}}]
userStats: [], //arr of game specific data [{player:discord.user, score:int}]
timerRunning: false,
currentRound: 1,
voiceChannel: "",
textChannel: "",
oddPlayerCount: false,
voters: [],
musicPlaying: false,
gameRunning: false
}
//events///////////////////////////////////////////////////////////////////////////////////////////////////////
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
CLIENT.once(event.name, (...args) => event.execute(...args));
} else {
CLIENT.on(event.name, (...args) => event.execute(...args));
}
}
module.exports = {config, gameData, CLIENT, GUILD_DATA, CLIENT, CONTENT_DATA}