function Util.MakeAliasCommand(Q,m)local H,N=unpack(Q:split("\124"))local b={}m=Util.EncodeEscapedOperators(m)local B={}for Q in m:gmatch("\036\040\037\100\043\041")do if B[Q]==nil then B[Q]=true local H=m:match("\036"..(Q.."\040\037\098\123\125\041"))local N,K,t if H then H=H:sub(2,#H-1)N,K,t=unpack(H:split("\124"))end N=N or"\115\116\114\105\110\103"K=K or"\065\114\103\117\109\101\110\116 "..Q t=t or""table.insert(b,{Type=N;Name=K,Description=t})end end return{Name=H;Aliases={},Description="\060\065\108\105\097\115\062 "..(N or m),Group="\085\115\101\114\065\108\105\097\115";Args=b;Run=function(Q)return Util.RunCommandString(Q.Dispatcher,Util.SubstituteArgs(m,Q.RawArguments))end}end

function Util.MakeAliasCommand(name, commandString)
	local commandName, commandDescription = unpack(name:split("|"))
	local args = {}

	commandString = Util.EncodeEscapedOperators(commandString)


	local seenArgs = {}

	for arg in commandString:gmatch("$(%d+)") do
		if seenArgs[arg] == nil then
			seenArgs[arg] = true
			local options = commandString:match("$" .. arg .. "(%b{})")

			local argType, argName, argDescription
			if options then
				options = options:sub(2, #options-1) -- remove braces
				argType, argName, argDescription = unpack(options:split("|"))
			end

			argType = argType or "string"
			argName = argName or ("Argument " .. arg)
			argDescription = argDescription or ""

			table.insert(args, {
				Type = argType;
				Name = argName;
				Description = argDescription;
			})
		end
	end

	return {
		Name = commandName,
		Aliases = {},
		Description = "<Alias> " .. (commandDescription or commandString),
		Group = "UserAlias",
		Args = args,
		Run = function(context)
			return Util.RunCommandString(context.Dispatcher, Util.SubstituteArgs(commandString, context.RawArguments))
		end
	}
end
