mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 04:21:41 +09:00
Fixed Chat Reply
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
--- Adds auto replies to chat messages; aswell as chat commands
|
||||
--- Adds auto replies to chat messages; as well as chat commands
|
||||
-- @addon Chat-Reply
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
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
|
||||
|
||||
@@ -18,16 +17,15 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
local prefix = config.command_prefix
|
||||
for key_word, reply in pairs(config.messages) do
|
||||
if message:find(key_word) then
|
||||
local is_command = message:find(prefix..key_word)
|
||||
if type(reply) == 'function' then
|
||||
reply = reply(player)
|
||||
reply = reply(player, is_command)
|
||||
end
|
||||
|
||||
if message:find(prefix..key_word) then
|
||||
if allowed then
|
||||
game.print{'chat-bot.reply', reply}
|
||||
else
|
||||
player.print{'chat-bot.disallow'}
|
||||
end
|
||||
if is_command and allowed then
|
||||
game.print{'chat-bot.reply', reply}
|
||||
elseif is_command then
|
||||
player.print{'chat-bot.disallow'}
|
||||
elseif not allowed then
|
||||
player.print{'chat-bot.reply', reply}
|
||||
end
|
||||
@@ -39,7 +37,7 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
for key_word, reply in pairs(config.commands) do
|
||||
if message:find(prefix..key_word) then
|
||||
if type(reply) == 'function' then
|
||||
reply = reply(player)
|
||||
reply = reply(player, true)
|
||||
|
||||
if reply then
|
||||
game.print{'chat-bot.reply', reply}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Task = require 'utils.task' --- @dep utils.task
|
||||
local Token = require 'utils.token' --- @dep utils.token
|
||||
local config = require 'config.compilatron' --- @dep config.compilatron
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
-- @addon Discord-Alerts
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Colors = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common
|
||||
local config = require 'config.discord_alerts' --- @dep config.discord_alerts
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local config = require 'config.spawn_area' --- @dep config.spawn_area
|
||||
local tiles = config.tiles
|
||||
local entities = config.entities
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
-- @addon Tree-Decon
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
|
||||
|
||||
Reference in New Issue
Block a user