Only taking room argument for Say when command is used in PM.

This commit is contained in:
ThePendulum 2021-11-15 21:01:34 +01:00
parent 276547cecb
commit e055eebbea
1 changed files with 4 additions and 4 deletions

View File

@ -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;