function module.Setup(e)local J=require(main.server.Modules.Commands)for e,J in pairs(J)do if type(J)=="\116\097\098\108\101"then local e=string.lower(J.Name)local B=main.settings.ChangeRankRequiredToUseCommand or main.settings.SetCommandRankByName local g=B[J.Name]or B[e]if g then if tonumber(g)==nil then g=(main:GetModule("\099\102")):GetRankId(g)end J.Rank=g elseif e=="\099\109\100\098\097\114"or e=="\099\109\100\098\097\114\050"then local B=e:gsub("\094\037\097",function(e)return string.upper(e)end)local g=main.settings[B]if g then if tonumber(g)==nil then g=(main:GetModule("\099\102")):GetRankId(g)end J.Rank=g main.settings[B]=g end end if e~=""then local function B()local e,B={},{}for g,M in pairs(J)do if(main:GetModule("\099\102")):FindValue(main.commandInfoToShowOnClient,g)then e[g]=M elseif g=="\085\110\070\117\110\099\116\105\111\110"and type(M)=="\102\117\110\099\116\105\111\110"then e.UnFunction="\117\110"..string.gsub(J.Name,"\037\097",function(e)return string.upper(e)end,1)end B[g]=M end local g={}if J.Args then for e,J in pairs(J.Args)do table.insert(g,string.lower(J))end end e.RankName=(main:GetModule("\099\102")):GetRankName(J.Rank)e.Args=g B.Args=g return e,B end local g,M=B()table.insert(main.commandInfo,g)main.commands[e]=M if J.SpecialColors then for e,g in pairs(main.settings.Colors)do local M=g[1]if M~="\119"then local e,H=B()local h=J.Name..M local z=g[3]e.SpecialColor=z e.SpecialColorName=M e.OriginalName=J.Name e.Name=h H.SpecialColor=z H.Name=h H.OriginalName=J.Name table.insert(main.commandInfo,e)main.commands[h]=H end end end for B,g in pairs(main.infoOnAllCommands)do local M=J[B]if type(M)=="\116\097\098\108\101"then for J,g in pairs(M)do if B~="\067\111\110\116\114\105\098\117\116\111\114\115"then g=string.lower(g)end if B=="\067\111\110\116\114\105\098\117\116\111\114\115"or B=="\084\097\103\115"then if B=="\067\111\110\116\114\105\098\117\116\111\114\115"and tonumber(g)then g=(main.main:GetModule("\099\102")):GetName(g)end local e=main.infoOnAllCommands[B][g]if e==nil then main.infoOnAllCommands[B][g]=1 else main.infoOnAllCommands[B][g]=e+1 end elseif B=="\065\108\105\097\115\101\115"then main.infoOnAllCommands[B][g]=e else main.infoOnAllCommands[B][g]=true end end end end main.commandRanks[e]=J.Rank end end end end return module

function module:Setup()
	local commandsToAdd = require(main.server.Modules.Commands)
	for i, command in pairs(commandsToAdd) do
		if type(command) == "table" then
			--ChangeRankRequiredToUseCommand
			local commandName = string.lower(command.Name)
			local changeRankByNameSetting = main.settings.ChangeRankRequiredToUseCommand or main.settings.SetCommandRankByName
			local changeRank = changeRankByNameSetting[command.Name] or changeRankByNameSetting[commandName]
			if changeRank then
				if tonumber(changeRank) == nil then
					changeRank = main:GetModule("cf"):GetRankId(changeRank)
				end
				command.Rank = changeRank
			elseif commandName == "cmdbar" or commandName == "cmdbar2"  then
				local settingName = commandName:gsub("^%a", function(c) return(string.upper(c)) end)
				local setting = main.settings[settingName]
				if setting then
					if tonumber(setting) == nil then
						setting = main:GetModule("cf"):GetRankId(setting)
					end
					command.Rank = setting
					main.settings[settingName] = setting
				end
			end
			--
			if commandName ~= "" then
				local function getCommandTables()
					local template, modified = {},{}
					for dataName, data in pairs(command) do
						if main:GetModule("cf"):FindValue(main.commandInfoToShowOnClient, dataName) then
							template[dataName] = data
						elseif dataName == "UnFunction" and type(data) == "function" then
							template["UnFunction"] = "un".. string.gsub(command.Name, "%a", function(c) return string.upper(c) end, 1)
						end
						modified[dataName] = data 
					end
					--
					local lowerCaseArgs = {}
					if command.Args then
						for i,v in pairs(command.Args) do
							table.insert(lowerCaseArgs, string.lower(v))
						end
					end
					template.RankName = main:GetModule("cf"):GetRankName(command.Rank)
					template.Args = lowerCaseArgs
					modified.Args = lowerCaseArgs
					--
					return template, modified	
				end
				local infoTemplate, modifiedCommand = getCommandTables()
				table.insert(main.commandInfo, infoTemplate)
				main.commands[commandName] = modifiedCommand
				--Special Colors
				if command.SpecialColors then
					for i,v in pairs(main.settings.Colors) do
						local shortName = v[1]
						if shortName ~= "w" then
							local newTemplate, newModifiedCommand = getCommandTables()
							local commandColorName = command.Name..shortName
							local color = v[3]
							newTemplate.SpecialColor = color
							newTemplate.SpecialColorName = shortName
							newTemplate.OriginalName = command.Name
							newTemplate.Name = commandColorName
							newModifiedCommand.SpecialColor = color
							newModifiedCommand.Name = commandColorName
							newModifiedCommand.OriginalName = command.Name
							table.insert(main.commandInfo, newTemplate)
							main.commands[commandColorName] = newModifiedCommand
						end
					end
				end
				--
				for infoName, infoTable in pairs(main.infoOnAllCommands) do
					local commandStat = command[infoName]
					if type(commandStat) == "table" then
						for i,v in pairs(commandStat) do
							if infoName ~= "Contributors" then
								v = string.lower(v)
							end
							if infoName == "Contributors" or infoName == "Tags" then
								if infoName == "Contributors" and tonumber(v) then
									v = main.main:GetModule("cf"):GetName(v)
								end
								local statCount = main.infoOnAllCommands[infoName][v]
								if statCount == nil then
									--if infoName ~= "Contributors" or not isCustomCommands then
										main.infoOnAllCommands[infoName][v] = 1
									--end
								else
									main.infoOnAllCommands[infoName][v] = statCount + 1
								end
							elseif infoName == "Aliases" then
								main.infoOnAllCommands[infoName][v] = commandName
							else
								main.infoOnAllCommands[infoName][v] = true
							end
						end
					end
				end
				main.commandRanks[commandName] = command.Rank
			end
		end
	end
end




return module
