diff --git a/squad-server/plugins/chat-commands.js b/squad-server/plugins/chat-commands.js index 9f0ca0f8..a16d1393 100644 --- a/squad-server/plugins/chat-commands.js +++ b/squad-server/plugins/chat-commands.js @@ -23,13 +23,15 @@ export default class ChatCommands extends BasePlugin { '
  • type - Either warn or broadcast.
  • ' + '
  • response - The message to respond with.
  • ' + '
  • ignoreChats - A list of chats to ignore the commands in. Use this to limit it to admins.
  • ' + + '
  • includeChats - A list of chats to include the commands in. Use this to limit it to admins.
  • ' + '', default: [ { command: 'squadjs', type: 'warn', response: 'This server is powered by SquadJS.', - ignoreChats: [] + ignoreChats: [], + includeChats: [] } ] } @@ -39,7 +41,11 @@ export default class ChatCommands extends BasePlugin { async mount() { for (const command of this.options.commands) { this.server.on(`CHAT_COMMAND:${command.command.toLowerCase()}`, async (data) => { - if (command.ignoreChats.includes(data.chat)) return; + let ignoreChats = command.ignoreChats ?? []; + let includeChats = command.includeChats ?? []; + + if (ignoreChats.includes(data.chat)) return; + if (includeChats.length > 0 && !includeChats.includes(data.chat)) return; if (command.type === 'broadcast') { await this.server.rcon.broadcast(command.response);