-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbot.js
67 lines (55 loc) · 1.57 KB
/
bot.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
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @name bot.js
* @description Main Bot Script
*/
/* eslint-disable no-unused-vars */
const VERSION = 'v0.9'
const BUILD_DATE = '2020/11/5'
/* eslint-enable no-unused-vars */
// import necessary modules
const path = require('path')
const BotClient = require('./classes/BotClient')
const CommandHandler = require('./classes/CommandHandler')
const LocaleHandler = require('./classes/LocaleHandler')
const onReadyEvent = require('./events/onReady')
const onMessageEvent = require('./events/onMessage')
/**
* Main Client
* @type {BotClient}
*/
const client = new BotClient()
client.VERSION = VERSION
client.BUILD_DATE = BUILD_DATE
/**
* Database
*/
client.setupDatabase()
// Setup Locale (i18n)
client.registerLocaleHandler(new LocaleHandler(client))
// event
client.registerEvent('ready', onReadyEvent)
client.registerEvent('message', onMessageEvent)
// Login to Discord
client.start()
client.registerCommandHandler(new CommandHandler(client))
client.commands.registerGroups([
'activation', // Activating and Deactivating Server
'dev', // For Development
'info', // Various Informations
'memo', // memo
'misc', // Other things
'util', // Utilities
'settings', // Settings
'game' // Games
])
client.commands.registerBaseCommands(path.join(path.resolve(), 'commands'))
// web server (Heroku web dyno placeholder)
const express = require('express')
const app = express()
/**
* web server port
* @type {number}
*/
const PORT = process.env.PORT || 5000
app.use(express.static('public'))
app.listen(PORT, () => client.logger.log('BOT MAIN', `Web server on port ${PORT}`))