Adapted kill command for IRC.
This commit is contained in:
		
							parent
							
								
									69afb24f63
								
							
						
					
					
						commit
						a9347ddd3a
					
				|  | @ -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}`); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue