local z=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")return{Name="\098\105\110\100";Aliases={},Description="\066\105\110\100\115 \097 \099\111\109\109\097\110\100 \115\116\114\105\110\103 \116\111 \097 \107\101\121 \111\114 \109\111\117\115\101 \105\110\112\117\116\046";Group="\068\101\102\097\117\108\116\085\116\105\108";Args={{Type="\117\115\101\114\073\110\112\117\116 \033 \098\105\110\100\097\098\108\101\082\101\115\111\117\114\099\101 \064 \112\108\097\121\101\114";Name="\073\110\112\117\116";Description="\084\104\101 \107\101\121 \111\114 \105\110\112\117\116 \116\121\112\101 \121\111\117\'\100 \108\105\107\101 \116\111 \098\105\110\100 \116\104\101 \099\111\109\109\097\110\100 \116\111\046"},{Type="\099\111\109\109\097\110\100",Name="\067\111\109\109\097\110\100";Description="\084\104\101 \099\111\109\109\097\110\100 \121\111\117 \119\097\110\116 \116\111 \114\117\110 \111\110 \116\104\105\115 \105\110\112\117\116"},{Type="\115\116\114\105\110\103";Name="\065\114\103\117\109\101\110\116\115";Description="\084\104\101 \097\114\103\117\109\101\110\116\115 \102\111\114 \116\104\101 \099\111\109\109\097\110\100",Default=""}};ClientRun=function(R,y,r,f)local l=R:GetStore("\067\077\068\082\095\066\105\110\100\115")r=r..(" "..f)if l[y]then l[y]:Disconnect()end local o=(R:GetArgument(1)).Type.Name if o=="\117\115\101\114\073\110\112\117\116"then l[y]=z.InputBegan:Connect(function(z,f)if f then return end if z.UserInputType==y or z.KeyCode==y then R:Reply(R.Dispatcher:EvaluateAndRun(R.Cmdr.Util.RunEmbeddedCommands(R.Dispatcher,r)))end end)elseif o=="\098\105\110\100\097\098\108\101\082\101\115\111\117\114\099\101"then return"\085\110\105\109\112\108\101\109\101\110\116\101\100\046\046\046"elseif o=="\112\108\097\121\101\114"then l[y]=y.Chatted:Connect(function(z)local f={z}local l=R.Cmdr.Util.RunEmbeddedCommands(R.Dispatcher,R.Cmdr.Util.SubstituteArgs(r,f))R:Reply(("\037\115 \036 \037\115 \058 \037\115"):format(y.Name,l,R.Dispatcher:EvaluateAndRun(l)),Color3.fromRGB(244,92,66))end)end return"\066\111\117\110\100 \099\111\109\109\097\110\100 \116\111 \105\110\112\117\116\046"end}
local UserInputService = game:GetService("UserInputService")

return {
	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 = "";
		}
	};

	ClientRun = function(context, bind, command, arguments)
		local binds = context:GetStore("CMDR_Binds")

		command = command .. " " .. arguments

		if binds[bind] then
			binds[bind]:Disconnect()
		end

		local bindType = context:GetArgument(1).Type.Name

		if bindType == "userInput" then
			binds[bind] = UserInputService.InputBegan:Connect(function(input, gameProcessed)
				if gameProcessed then
					return
				end

				if input.UserInputType == bind or input.KeyCode == bind then
					context:Reply(context.Dispatcher:EvaluateAndRun(context.Cmdr.Util.RunEmbeddedCommands(context.Dispatcher, command)))
				end
			end)
		elseif bindType == "bindableResource" then
			return "Unimplemented..."
		elseif bindType == "player" then
			binds[bind] = bind.Chatted:Connect(function(message)
				local args = { message }
				local chatCommand = context.Cmdr.Util.RunEmbeddedCommands(context.Dispatcher, context.Cmdr.Util.SubstituteArgs(command, args))
				context:Reply(("%s $ %s : %s"):format(
					bind.Name,
					chatCommand,
					context.Dispatcher:EvaluateAndRun(chatCommand)
				), Color3.fromRGB(244, 92, 66))
			end)
		end


		return "Bound command to input."
	end
}