From e055eebbeaaaa8badebc35d66772f74537b83ce8 Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Mon, 15 Nov 2021 21:01:34 +0100 Subject: [PATCH] Only taking room argument for Say when command is used in PM. --- src/games/say.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/games/say.js b/src/games/say.js index dab728e..9e7d7d3 100644 --- a/src/games/say.js +++ b/src/games/say.js @@ -2,14 +2,14 @@ const config = require('config'); -function onCommand([rawRoomName, ...words], context) { +function onCommand(args, context) { if (!config.operators?.includes(context.user.username)) { return; } - const roomName = rawRoomName.replace(/#+/, ''); - const message = words.join(' '); - const room = Object.values(context.bot.rooms).find((botRoom) => botRoom.name === roomName); + const message = context.room ? args.join(' ') : args.slice(1).join(' '); + const roomName = args[0].replace(/#+/, ''); + const room = context.room || Object.values(context.bot.rooms).find((botRoom) => botRoom.name === roomName); if (!room) { return;