-- Decompiled with the Synapse X Luau decompiler.


local v1 = {
	Name = "bind", 
	Aliases = {}, 
	Description = "Binds a command string to a key or mouse input.", 
	Group = "DefaultUtil", 
	Args = { {
			Type = "userInput ! bindableResource @ player", 
			Name = "Input", 
			Description = "The key or input type you'd like to bind the command to."
		}, {
			Type = "command", 
			Name = "Command", 
			Description = "The command you want to run on this input"
		}, {
			Type = "string", 
			Name = "Arguments", 
			Description = "The arguments for the command", 
			Default = ""
		} }
};
local l__UserInputService__1 = game:GetService("UserInputService");
function v1.ClientRun(p1, p2, p3, p4)
	local v2 = p1:GetStore("CMDR_Binds");
	p3 = p3 .. " " .. p4;
	if v2[p2] then
		v2[p2]:Disconnect();
	end;
	local l__Name__3 = p1:GetArgument(1).Type.Name;
	if l__Name__3 == "userInput" then
		v2[p2] = l__UserInputService__1.InputBegan:Connect(function(p5, p6)
			if p6 then
				return;
			end;
			if p5.UserInputType == p2 or p5.KeyCode == p2 then
				p1:Reply(p1.Dispatcher:EvaluateAndRun(p1.Cmdr.Util.RunEmbeddedCommands(p1.Dispatcher, p3)));
			end;
		end);
	else
		if l__Name__3 == "bindableResource" then
			return "Unimplemented...";
		end;
		if l__Name__3 == "player" then
			v2[p2] = p2.Chatted:Connect(function(p7)
				local v4 = p1.Cmdr.Util.RunEmbeddedCommands(p1.Dispatcher, p1.Cmdr.Util.SubstituteArgs(p3, { p7 }));
				p1:Reply(("%s $ %s : %s"):format(p2.Name, v4, p1.Dispatcher:EvaluateAndRun(v4)), Color3.fromRGB(244, 92, 66));
			end);
		end;
	end;
	return "Bound command to input.";
end;
return v1;
