Implement enabling/disabling commands

This commit is contained in:
2025-01-05 23:54:18 +01:00
parent aa46000abf
commit 8d3813f3ee
6 changed files with 23 additions and 16 deletions

View File

@@ -191,8 +191,11 @@ function shared.Commander.Init()
sender = string.match(sender, "^[^-]+")
for _, command in ipairs(commands) do
if not command.commanderOnly or
(command.commanderOnly and sender == Heimdall_Data.config.commander.commander) then
local enabled = Heimdall_Data.config.commander.commands[command.keywordRe] == true or false
if enabled and
(not command.commanderOnly
or (command.commanderOnly
and sender == Heimdall_Data.config.commander.commander)) then
if msg:match(command.keywordRe) then
local messages = command.callback({ strsplit(" ", msg) })
for _, message in ipairs(messages) do