Added say command with operator config.

This commit is contained in:
2021-11-15 20:44:34 +01:00
parent 2ddac57365
commit 18ffdefffb
3 changed files with 27 additions and 3 deletions

23
src/games/say.js Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
const config = require('config');
function onCommand([rawRoomName, ...words], 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);
if (!room) {
return;
}
context.sendMessage(message, room.id, { label: false });
}
module.exports = {
onCommand,
};