-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchitanda.js
More file actions
46 lines (42 loc) · 1.71 KB
/
chitanda.js
File metadata and controls
46 lines (42 loc) · 1.71 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
const Discord = require('discord.js')
const config = require('./config.json')
const DatabaseFactory = require('./database/databaseFactory')
const CommandManager = require('./managers/commandManager.js')
const PresenceManager = require('./managers/presenceManager.js')
const BotListingManager = require('./managers/botListingManager')
const SchedulerManager = require('./managers/schedulerManager')
const ErrorLog = require('./logger/errorlog')
const CommandLog = require('./logger/commandLog')
const ChatLog = require('./logger/chatLog')
const GuildLog = require('./logger/guildLog')
const MessageUtil = require('./util/messageUtil')
const stringUtil = require('./util/stringUtil') //inject some utilities to all String
class Chitanda extends Discord.Client {
/**
* @param {string} cmdPath
* @param {*} options
*/
constructor(cmdPath, options) {
super(options);
/**
* @description When client connected to discord and commands are loaded
*/
this.ready = false;
this.errorLogger = new ErrorLog(this);
this.messageUtil = new MessageUtil(this);
this.database = new DatabaseFactory(this);
this.commandManager = new CommandManager(this, cmdPath);
this.presenceManager = new PresenceManager(this, config);
this.delayCreateBotListingManager();
this.commandLogger = new CommandLog(this);
this.chatLogger = new ChatLog(this);
this.guildLogger = new GuildLog(this);
this.schedulerManager = new SchedulerManager(this);
}
delayCreateBotListingManager() {
this.once('ready', () => {
this.botListingManager = new BotListingManager(this);;
});
}
}
module.exports = Chitanda;