From f455635e0a097fa3352216e123ddea019fb80dfc Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Tue, 16 Nov 2021 19:10:58 +0100 Subject: [PATCH] Added kill command and PM2 ecosystem file with restart delay. --- ecosystem.config.js | 4 ++++ src/app.js | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 ecosystem.config.js diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..0eb9b92 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,4 @@ +module.exports = { + script: 'src/app.js', + restart_delay: 5000, +}; diff --git a/src/app.js b/src/app.js index 406508d..fbc32f7 100644 --- a/src/app.js +++ b/src/app.js @@ -145,6 +145,11 @@ function onMessage(message, bot, games) { const user = bot.users[message.userId] || message.user; const room = bot.rooms[message.roomId]; + if (command === 'kill') { + process.exit(); + return; + } + if (command) { const args = body.split(/\s+/).slice(1); const game = games[command];