-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·35 lines (30 loc) · 922 Bytes
/
server.js
File metadata and controls
executable file
·35 lines (30 loc) · 922 Bytes
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
#!/usr/bin/env node
const config = require('./config')
const githash = require('githash')
const path = require('path')
const modules = require('./modules')
const irc = require('irc')
const logger = require('./logger')
global.__rootdir = path.resolve(__dirname)
const bot = new irc.Client(config.get('irc.server'), config.get('irc.nick'), config.get('irc'))
bot.config = config
module.exports = bot
bot.log = logger
bot.reload = function () {
return modules.loadAllModules(bot)
}
if (!bot.config.quiet) {
bot.log('info', 'civilservant ' + githash())
}
bot.connect((welcomeMsg) => {
if (welcomeMsg.user && welcomeMsg.host) {
bot.log('info', `Connected to ${welcomeMsg.host} as ${welcomeMsg.user}`)
} else {
bot.log('info', 'Connected')
}
if (welcomeMsg.args && welcomeMsg.args.length > 1) {
bot.log('verbose', welcomeMsg.args[1])
}
modules.loadAllModules(bot, './plugins')
bot.reload()
})