local J=script.Parent.Parent.packages local T=require(J.cmdr)local c=require(J.fusion)local V=require(J.states)local function M()local J=T.new({})for T,c in script.Parent.Parent.modules:GetChildren()do local M=require(c)J:newCommand({name=M.name,description=M.Description,arguments=M.arguments;callback=M.callback})V.add("\067\111\109\109\097\110\100\115",M,M.name)end local M=c.Observer(V.ToExecute)M:onChange(function()local T=V.ToExecute:get()if T==""then return end J:executeCommand(T)end)end M()
--[[
	File: suggestions.client.lua
	Keeps track of suggestions and changes the global state
]]

-- < Imports >
local Packages = script.Parent.Parent.packages
local Cmdr = require(Packages.cmdr)
local Fusion = require(Packages.fusion)
local States = require(Packages.states)

-- < Handling >
local function main()
	local Handler = Cmdr.new({})

	for _, module in script.Parent.Parent.modules:GetChildren() do
		local moduleData = require(module)

		Handler:newCommand({
			name = moduleData.name,
			description = moduleData.Description,
			arguments = moduleData.arguments,
			callback = moduleData.callback,
		})

		States.add("Commands", moduleData, moduleData.name)
	end

	local executeObserver = Fusion.Observer(States.ToExecute)
	executeObserver:onChange(function()
		local stringToExecute = States.ToExecute:get()

		if stringToExecute == "" then
			return
		end

		Handler:executeCommand(stringToExecute)
	end)
end

main()
