Adapted kill command for IRC.

This commit is contained in:
ThePendulum 2022-10-21 05:21:27 +02:00
parent 69afb24f63
commit a9347ddd3a
1 changed files with 12 additions and 6 deletions

View File

@ -1,12 +1,18 @@
'use strict';
const config = require('config');
function onCommand(args, context) {
context.bot.socket.transmit('message', {
roomId: context.room?.id,
recipient: context.message.user?.username,
body: 'Shutting down... :sleeping:',
style: config.style,
});
if (config.platform === 'schat') {
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.nick) {
// 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 });
}
context.logger.info(`Kill command used by ${context.user.username}`);