-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.js
executable file
·46 lines (34 loc) · 1.32 KB
/
start.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
var { Client } = require('discord.js')
var logger = require('winston')
var command = require('./src/command/command')
var slashCommand = require('./src/command/slashCommand')
// Configure logger settings
logger.remove(logger.transports.Console)
logger.add(new logger.transports.Console, {
colorize: true
})
logger.level = 'debug'
// Initialize Discord client
var client = new Client({ intents: ['GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'GUILDS'], partials: ['MESSAGE', 'CHANNEL', 'REACTION'] })
client.on('ready', () => {
client.user.setPresence({ activities: [{ name: 'm/help', type: 'WATCHING' }], status: 'online' })
logger.info('Ready!~')
})
client.once('reconnecting', () => {
console.log('Reconnecting!')
})
client.once('disconnect', () => {
console.log('Disconnect!')
})
client.on('error', err => {
console.error('Client Error: ' + err)
})
client.on('messageCreate', command.processCmd)
client.on('interactionCreate', slashCommand.processSlashCmd)
client.login(process.env.MAVIS_BOT_TOKEN)
// I'll leave this here just in case in need of a ping target
// http.createServer((request, response) => {
// console.log("Received request to wake up! (" + new Date(Date.now()).toLocaleString("en-US", { timezone: 'Asia/Jakarta' }) + ")")
// response.writeHead(200)
// response.end('Pong!')
// }).listen(process.env.PORT || 6969)