local D="\117\110"local p={}function p.findCommand(n)n=string.lower(n)local I="\105\110\118\111\107\101"if string.sub(n,1,#D)==D then I="\114\101\118\111\107\101"end for D,p in ipairs(p.cache)do if string.lower(p.name)==n then return p,I end for D,b in ipairs(p.aliases or{})do if string.lower(b)==n then return p,I end end for D,b in ipairs(p.opposites or{})do if string.lower(b)==n then I="\114\101\118\111\107\101"return p,I end end end end return p
-- OptimisticSide
-- 5/9/2021
-- Command manager

local REVOKE_PREFIX = "un"

local Commands = {}

-- Find a command.
function Commands.findCommand(call)
	-- Commands are not case-sensitive.
	call = string.lower(call)

	-- Handle reverse commands.
	local procedure = "invoke"
	if string.sub(call, 1, #REVOKE_PREFIX) == REVOKE_PREFIX then
		procedure = "revoke"
	end

	for _, command in ipairs(Commands.cache) do
		-- Check if command's name matches.
		if string.lower(command.name) == call then
			return command, procedure
		end

		-- Check command's aliases.
		for _, aliase in ipairs(command.aliases or {}) do
			if string.lower(aliase) == call then
				return command, procedure
			end
		end

		-- Check for special opposites.
		for _, opposite in ipairs(command.opposites or {}) do
			if string.lower(opposite) == call then
				procedure = "revoke"
				return command, procedure
			end
		end
	end
end

return Commands
