UNPKG

728 BJavaScriptView Raw
1const log = logger.withScope('login')
2
3const ConnectionsManager = require('./ConnectionsManager')
4const updateNotifier = require('./updateNotifier')
5
6const { login: messengerLogin } = require('./messenger')
7const { login: discordLogin } = require('./discord')
8
9module.exports = async () => {
10 logger.start('Launching Miscord v' + require('../package.json').version)
11 log.start('Logging in...')
12 log.trace('config', config)
13 log.info('logLevel', config.logLevel)
14
15 // check for updates if enabled in the config
16 if (config.checkUpdates) await updateNotifier()
17 global.connections = new ConnectionsManager()
18 return discordLogin().then(messengerLogin).then(() => connections.load()).then(() => log.success('Logged in'))
19}