local s=game:GetService("\067\104\097\116")local W=s:WaitForChild("\067\108\105\101\110\116\067\104\097\116\077\111\100\117\108\101\115")local c=W:WaitForChild("\067\111\109\109\097\110\100\077\111\100\117\108\101\115")local E=require(c:WaitForChild("\085\116\105\108"))local F=script.Parent local n=require(W:WaitForChild("\067\104\097\116\083\101\116\116\105\110\103\115"))function methods.SetupCommandProcessors(s)local W=c:GetChildren()for c=1,#W,1 do if W[c]:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then if W[c].Name~="\085\116\105\108"then local F=require(W[c])local n=F[E.KEY_COMMAND_PROCESSOR_TYPE]local e=F[E.KEY_PROCESSOR_FUNCTION]if n==E.IN_PROGRESS_MESSAGE_PROCESSOR then table.insert(s.InProgressMessageProcessors,e)elseif n==E.COMPLETED_MESSAGE_PROCESSOR then table.insert(s.CompletedMessageProcessors,e)end end end end end function methods.ProcessCompletedChatMessage(c,s,W)for E=1,#c.CompletedMessageProcessors,1 do local F=c.CompletedMessageProcessors[E](s,W,n)if F then return true end end return false end function methods.ProcessInProgressChatMessage(E,s,W,c)for F=1,#E.InProgressMessageProcessors,1 do local e=E.InProgressMessageProcessors[F](s,W,c,n)if e then return e end end return nil end

local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local commandModules = clientChatModules:WaitForChild("CommandModules")
local commandUtil = require(commandModules:WaitForChild("Util"))
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))

function methods:SetupCommandProcessors()
	local commands = commandModules:GetChildren()
	for i = 1, #commands do
		if commands[i]:IsA("ModuleScript") then
			if commands[i].Name ~= "Util" then
				local commandProcessor = require(commands[i])
				local processorType = commandProcessor[commandUtil.KEY_COMMAND_PROCESSOR_TYPE]
				local processorFunction = commandProcessor[commandUtil.KEY_PROCESSOR_FUNCTION]
				if processorType == commandUtil.IN_PROGRESS_MESSAGE_PROCESSOR then
					table.insert(self.InProgressMessageProcessors, processorFunction)
				elseif processorType == commandUtil.COMPLETED_MESSAGE_PROCESSOR then
					table.insert(self.CompletedMessageProcessors, processorFunction)
				end
			end
		end
	end
end

function methods:ProcessCompletedChatMessage(message, ChatWindow)
	for i = 1, #self.CompletedMessageProcessors do
		local processedCommand = self.CompletedMessageProcessors[i](message, ChatWindow, ChatSettings)
		if processedCommand then
			return true
		end
	end
	return false
end

function methods:ProcessInProgressChatMessage(message, ChatWindow, ChatBar)
	for i = 1, #self.InProgressMessageProcessors do
		local customState = self.InProgressMessageProcessors[i](message, ChatWindow, ChatBar, ChatSettings)
		if customState then
			return customState
		end
	end
	return nil
end
