26 lines
472 B
JavaScript
26 lines
472 B
JavaScript
|
|
let oauth = require('./oauth.js')
|
|
let storage = require('./storage.js')
|
|
let bot = require('./bot.js')
|
|
|
|
const crypto = require('crypto')
|
|
|
|
|
|
// main
|
|
let main = () => {
|
|
storage.init()
|
|
|
|
if (!storage.data.sess_secret) {
|
|
storage.data.sess_secret = crypto.randomBytes(128).toString('base64')
|
|
storage.save()
|
|
}
|
|
|
|
if (storage.data.token && storage.data.token_secret) {
|
|
console.log('[INFO] Starting bot')
|
|
bot.start()
|
|
} else {
|
|
oauth.start()
|
|
}
|
|
}
|
|
|
|
main()
|