mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 12:16:37 +09:00
Fixed Existing Lua Check Errors
This commit is contained in:
@@ -6,17 +6,17 @@ local Game = require 'utils.game' --- @dep utils.game
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local config = require 'config.chat_reply' --- @dep config.chat_reply
|
||||
|
||||
Event.add(defines.events.on_console_chat,function(event)
|
||||
Event.add(defines.events.on_console_chat, function(event)
|
||||
local player_index = event.player_index
|
||||
if not player_index or player_index < 1 then return end
|
||||
local player = Game.get_player_by_index(player_index)
|
||||
local message = event.message:lower():gsub("%s+", "")
|
||||
local allowed = true
|
||||
if config.command_admin_only and not player.admin then allowed = false end
|
||||
if config.command_permission and not Roles.player_allowed(player,config.command_permission) then allowed = false end
|
||||
if config.command_permission and not Roles.player_allowed(player, config.command_permission) then allowed = false end
|
||||
|
||||
local prefix = config.command_prefix
|
||||
for key_word,reply in pairs(config.messages) do
|
||||
for key_word, reply in pairs(config.messages) do
|
||||
if message:find(key_word) then
|
||||
if type(reply) == 'function' then
|
||||
reply = reply(player)
|
||||
@@ -24,29 +24,29 @@ Event.add(defines.events.on_console_chat,function(event)
|
||||
|
||||
if message:find(prefix..key_word) then
|
||||
if allowed then
|
||||
game.print{'chat-bot.reply',reply}
|
||||
game.print{'chat-bot.reply', reply}
|
||||
else
|
||||
player.print{'chat-bot.disallow'}
|
||||
end
|
||||
elseif not allowed then
|
||||
player.print{'chat-bot.reply',reply}
|
||||
player.print{'chat-bot.reply', reply}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not allowed then return end
|
||||
|
||||
for key_word,reply in pairs(config.commands) do
|
||||
for key_word, reply in pairs(config.commands) do
|
||||
if message:find(prefix..key_word) then
|
||||
if type(reply) == 'function' then
|
||||
reply = reply(player)
|
||||
|
||||
if reply then
|
||||
game.print{'chat-bot.reply',reply}
|
||||
game.print{'chat-bot.reply', reply}
|
||||
end
|
||||
|
||||
else
|
||||
game.print{'chat-bot.reply',reply}
|
||||
game.print{'chat-bot.reply', reply}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user