function Util.MakeAliasCommand(M,V)local h,Q=unpack(M:split("\124"))local o={}V=Util.EncodeEscapedOperators(V)local d={}for M in V:gmatch("\036\040\037\100\043\041")do if d[M]==nil then d[M]=true local h=V:match("\036"..(M.."\040\037\098\123\125\041"))local Q,c,N if h then h=h:sub(2,#h-1)Q,c,N=unpack(h:split("\124"))end Q=Q or"\115\116\114\105\110\103"c=c or"\065\114\103\117\109\101\110\116 "..M N=N or""table.insert(o,{Type=Q,Name=c,Description=N})end end return{Name=h;Aliases={};Description="\060\065\108\105\097\115\062 "..(Q or V),Group="\085\115\101\114\065\108\105\097\115";Args=o;Run=function(M)return Util.RunCommandString(M.Dispatcher,Util.SubstituteArgs(V,M.RawArguments))end}end
--- Creates an alias command
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
