27 lines
930 B
JavaScript
27 lines
930 B
JavaScript
'use strict';
|
|
|
|
const config = require('config');
|
|
|
|
function onCommand(args, context) {
|
|
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}`);
|
|
|
|
setTimeout(() => process.exit(), 1000);
|
|
}
|
|
|
|
module.exports = {
|
|
commands: ['kill', 'restart', 'shutdown'],
|
|
help: `Am I getting a little confused? Try to ${config.prefix}restart me.`,
|
|
onCommand,
|
|
};
|