-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApp.js
More file actions
67 lines (57 loc) · 1.75 KB
/
App.js
File metadata and controls
67 lines (57 loc) · 1.75 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
// Environment
require('dotenv').config()
// Initialize discord + client
const Discord = require('discord.js');
const client = new Discord.Client();
// Local config files
const CONFIG = require('./config/Config');
const {MESSAGES, COMMANDS} = require('./config/Messages');
// Local imports
const Crons = require('./crons/Crons.js').Crons;
const Events = require('./discord/Events.js').Events;
const Connect = require('./discord/Connect.js').Connect;
const Methods = require('./discord/Methods.js').Methods;
const Commands = require('./discord/Commands.js').Commands;
const Scraper = require('./web/Scraper.js').Scraper;
const Checker = require('./web/Checker').Checker;
const Database = require('./data/Database').Database;
const Util = require('./util/Util.js').Util;
class App {
constructor() {
// Set the client inside the app
this.client = client;
this.db;
this.CONFIG = CONFIG;
this.MESSAGES = MESSAGES;
this.COMMANDS = COMMANDS;
// Set all application modules inside the main app
this.crons = new Crons(this);
this.events = new Events(this);
this.connect = new Connect(this);
this.methods = new Methods(this);
this.commands = new Commands(this);
this.scraper = new Scraper(this);
this.checker = new Checker(this);
this.database = new Database(this);
this.util = new Util();
this.init();
}
// Initialize connection with Discord
init() {
console.log('Logging into discord servers');
this.database.start();
this.events.initEvents();
this.connect.login();
}
initCrons() {
// this.crons.testReset();
this.crons.updateOwnTime();
this.crons.dailyReset();
this.crons.weeklyReset();
this.crons.guildQuestReset();
this.crons.checkNewsWebsite();
this.crons.checkLoginServer();
}
}
// Initialize local app
const app = new App();