Browse Source
Adding shutdown hook
Adding shutdown hook
* Migrated some code into Bot class * Added shutdown hook with async pattern to send shutdown message * Added utility module * Added buildInfo version on startup and in startup messagepull/10/head
Drew Short
5 years ago
3 changed files with 104 additions and 19 deletions
-
99bot/bot.js
-
18bot/utility.js
-
6index.js
@ -0,0 +1,18 @@ |
|||
function toISODateString(d) { |
|||
function pad(n) { return n < 10 ? '0' + n : n } |
|||
return d.getUTCFullYear() + '-' |
|||
+ pad(d.getUTCMonth() + 1) + '-' |
|||
+ pad(d.getUTCDate()) + 'T' |
|||
+ pad(d.getUTCHours()) + ':' |
|||
+ pad(d.getUTCMinutes()) + ':' |
|||
+ pad(d.getUTCSeconds()) + 'Z' |
|||
} |
|||
|
|||
function sleep(ms){ |
|||
return new Promise(resolve=>{ |
|||
setTimeout(resolve,ms) |
|||
}) |
|||
} |
|||
|
|||
exports.toISODateString = toISODateString; |
|||
exports.sleep = sleep; |
@ -1,2 +1,6 @@ |
|||
let bot = require('./bot/bot.js'); |
|||
bot.run(bot.init(bot.create("../data/config.json"))); |
|||
bot.run( |
|||
bot.init( |
|||
bot.create("../data/config.json") |
|||
) |
|||
); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue