From 98a1aa8ffffa92e2841aa942d3b76af1796a8a41 Mon Sep 17 00:00:00 2001 From: ThePendulum Date: Thu, 17 Aug 2023 22:38:43 +0200 Subject: [PATCH] Revealing who used kill command in all active rooms. --- src/games/kill.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/games/kill.js b/src/games/kill.js index 61e5674..0cf5824 100755 --- a/src/games/kill.js +++ b/src/games/kill.js @@ -2,16 +2,30 @@ const config = require('config'); +const style = require('../utils/style'); + function onCommand(args, context) { if (config.platform === 'schat') { - context.sendMessage('Shutting down... :sleeping:', context.room?.id, { type: 'message', label: false }, context.message.user?.username); + Object.keys(context.bot.rooms).forEach((roomId) => { + context.sendMessage(`Kill command used by ${style.bold(context.user.username)}, shutting down... :sleeping:`, roomId, { type: 'message', label: false }); + }); + + if (context.message.user) { + context.sendMessage('Shutting down... :sleeping:', context.room?.id, { type: 'message', label: false }, context.message.user.username); + } } - if (config.platform === 'irc' && context.room.id === config.user.id) { - // if the room ID is the bot's own nickname, it's a PM and we should reply to the sender - context.sendMessage('Shutting down... 😴', context.user.id, { label: false }); - } else if (config.platform === 'irc') { - context.sendMessage('Shutting down... 😴', context.room?.id, { type: 'message', label: false }); + if (context.platform === 'irc') { + Object.keys(context.bot.rooms).forEach((roomId) => { + context.sendMessage(`Kill command used by ${style.bold(context.user.username)}, shutting down... :sleeping:`, roomId, { type: 'message', label: false }); + }); + + if (context.room.id === config.user.id) { + // if the room ID is the bot's own nickname, it's a PM and we should reply to the sender + context.sendMessage('Shutting down... 😴', context.user.id, { label: false }); + } else { + context.sendMessage('Shutting down... 😴', context.room?.id, { type: 'message', label: false }); + } } context.logger.info(`Kill command used by ${context.user.username}`);