return function()local l,b,A,L,K,a,Z,M,R,m local function j()l=server.Functions b=server.Admin A=server.Anti L=server.Core K=server.HTTP a=server.Logs Z=server.Remote M=server.Process R=server.Variables m=server.Settings a:AddLog("\083\099\114\105\112\116","\072\084\084\080 \077\111\100\117\108\101 \073\110\105\116\105\097\108\105\122\101\100")end server.HTTP={Init=j,Service=service.HttpService,CheckHttp=function()local l,b=pcall(function()local l=service.HttpService local b=l:GetAsync("\104\116\116\112\058\047\047\103\111\111\103\108\101\046\099\111\109")end)if l and not b then return true end end,Trello={Helpers={};Moderators={},Admins={},Owners={},Creators={};Mutes={},Bans={};Music={},Agents={},Blacklist={};Whitelist={},PerformedCommands={},Update=function()if not K.CheckHttp()then warn("\072\116\116\112 \105\115 \110\111\116 \101\110\097\098\108\101\100\033 \067\097\110\110\111\116 \099\111\110\110\101\099\116 \116\111 \084\114\101\108\108\111\033")elseif not m.Trello_Enabled then else local l={}local A={}local L={}local M={}local R={}local j={}local P={}local s={}local O={}local f={}local t={}local V={}local T={}local function g(l)local Z=K.Trello.API(m.Trello_AppKey,m.Trello_Token)local j=Z.getLists(l)local t=Z.getListObj(j,{"\066\097\110\108\105\115\116";"\066\097\110 \076\105\115\116";"\066\097\110\115"})local g=Z.getListObj(j,{"\067\111\109\109\097\110\100\115";"\067\111\109\109\097\110\100 \076\105\115\116"})local n=Z.getListObj(j,{"\065\100\109\105\110\115","\065\100\109\105\110 \076\105\115\116","\065\100\109\105\110\108\105\115\116"})local U=Z.getListObj(j,{"\077\111\100\101\114\097\116\111\114\115","\077\111\100\101\114\097\116\111\114 \076\105\115\116","\077\111\100\101\114\097\116\111\114\108\105\115\116","\077\111\100\108\105\115\116","\077\111\100 \076\105\115\116","\077\111\100\115"})local J=Z.getListObj(j,{"\067\114\101\097\116\111\114\115";"\067\114\101\097\116\111\114 \076\105\115\116","\067\114\101\097\116\111\114\108\105\115\116","\080\108\097\099\101 \079\119\110\101\114\115"})local x=Z.getListObj(j,{"\079\119\110\101\114\115","\079\119\110\101\114 \076\105\115\116","\079\119\110\101\114\108\105\115\116"})local Y=Z.getListObj(j,{"\077\117\115\105\099","\077\117\115\105\099 \076\105\115\116";"\077\117\115\105\099\108\105\115\116";"\083\111\110\103\115"})local I=Z.getListObj(j,{"\080\101\114\109\105\115\115\105\111\110\115","\080\101\114\109\105\115\115\105\111\110 \076\105\115\116","\080\101\114\109\108\105\115\116"})local y=Z.getListObj(j,{"\077\117\116\101\108\105\115\116","\077\117\116\101 \076\105\115\116"})local H=Z.getListObj(j,{"\065\103\101\110\116\115";"\065\103\101\110\116 \076\105\115\116";"\065\103\101\110\116\108\105\115\116"})local u=Z.getListObj(j,"\066\108\097\099\107\108\105\115\116")local E=Z.getListObj(j,"\087\104\105\116\101\108\105\115\116")if t then local l=Z.getCards(t.id)for l,b in pairs(l)do table.insert(A,b.name)end end if J then local l=Z.getCards(J.id)for l,b in pairs(l)do table.insert(P,b.name)end end if U then local l=Z.getCards(U.id)for l,b in pairs(l)do table.insert(M,b.name)end end if n then local l=Z.getCards(n.id)for l,b in pairs(l)do table.insert(L,b.name)end end if x then local l=Z.getCards(x.id)for l,b in pairs(l)do table.insert(R,b.name)end end if H then local l=Z.getCards(H.id)for l,b in pairs(l)do table.insert(s,b.name)end end if Y then local l=Z.getCards(Y.id)for l,b in pairs(l)do if b.name:match("\094\040\046\042\041\058\040\046\042\041")then local l,A=b.name:match("\094\040\046\042\041\058\040\046\042\041")table.insert(O,{Name=l,ID=tonumber(A)})end end end if y then local l=Z.getCards(y.id)for l,b in pairs(l)do table.insert(f,b.name)end end if u then local l=Z.getCards(u.id)for l,b in pairs(l)do table.insert(V,b.name)end end if E then local l=Z.getCards(E.id)for l,b in pairs(l)do table.insert(T,b.name)end end if I then local l=Z.getCards(I.id)for l,A in pairs(l)do local L,K=A.name:match("\094\040\046\042\041\058\040\046\042\041")if L and K then b.SetPermission(L,K)end end end if g then local l=Z.getCards(g.id)for l,A in pairs(l)do if not K.Trello.PerformedCommands[tostring(A.id)]then local l=A.name local L if l:sub(1,1)=="\036"then L=(l:sub(2)):match("\046\037\100\043")l=l:sub(#L+2)L=tonumber(L)end if L and game.PlaceId~=L then return end b.RunCommand(l)K.Trello.PerformedCommands[tostring(A.id)]=true a.AddLog(a.Script,{Text="\084\114\101\108\108\111 \099\111\109\109\097\110\100 \101\120\101\099\117\116\101\100";Desc=l})if m.Trello_Token~=""then pcall(Z.makeComment,A.id,"\082\097\110 \067\111\109\109\097\110\100\058 "..(l..("\n\080\108\097\099\101 \073\068\058 "..(game.PlaceId..("\n\083\101\114\118\101\114 \074\111\098 \073\100\058 "..(game.JobId..("\n\083\101\114\118\101\114 \080\108\097\121\101\114\115\058 "..(#service.GetPlayers()..("\n\083\101\114\118\101\114 \084\105\109\101\058 "..service.GetTime())))))))))end end end end end for b,A in pairs(m.Trello_Secondary)do table.insert(l,A)end if m.Trello_Primary~=""then table.insert(l,m.Trello_Primary)end for l,b in pairs(l)do pcall(g,b)end if#A>0 then K.Trello.Bans=A end if#P>0 then K.Trello.Creators=P end if#L>0 then K.Trello.Admins=L end if#M>0 then K.Trello.Moderators=M end if#R>0 then K.Trello.Owners=R end if#O>0 then K.Trello.Music=O end if#f>0 then K.Trello.Mutes=f end if#s>0 then K.Trello.Agents=s end if#V>0 then K.Trello.Blacklist=V end if#T>0 then K.Trello.Whitelist=T end for l,A in pairs(service.GetPlayers())do local L=b.CheckBan(A)if L[1]then A:Kick(L[2])end if A and A.Parent then for l,L in pairs(K.Trello.Mutes)do if b.DoCheck(A,L)then Z.LoadCode(A,"\115\101\114\118\105\099\101\046\083\116\097\114\116\101\114\071\117\105\058\083\101\116\067\111\114\101\071\117\105\069\110\097\098\108\101\100\040\"\067\104\097\116\"\044\102\097\108\115\101\041 \099\108\105\101\110\116\046\086\097\114\105\097\098\108\101\115\046\067\104\097\116\069\110\097\098\108\101\100 \061 \102\097\108\115\101 \099\108\105\101\110\116\046\086\097\114\105\097\098\108\101\115\046\077\117\116\101\100 \061 \116\114\117\101")end end end b.UpdateCachedLevel(A)end a.AddLog(a.Script,{Text="\085\112\100\097\116\101\100 \084\114\101\108\108\111 \068\097\116\097";Desc="\068\097\116\097 \119\097\115 \114\101\116\114\101\105\118\101\100 \102\114\111\109 \084\114\101\108\108\111"})end end,CheckAgent=function(l)for A,L in pairs(K.Trello.Agents)do if b.DoCheck(l,L)then return true end end end}}end

return function()
	local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings
	local function Init()
		Functions = server.Functions;
		Admin = server.Admin;
		Anti = server.Anti;
		Core = server.Core;
		HTTP = server.HTTP;
		Logs = server.Logs;
		Remote = server.Remote;
		Process = server.Process;
		Variables = server.Variables;
		Settings = server.Settings;
		
		Logs:AddLog("Script", "HTTP Module Initialized")
	end;
	
	server.HTTP = {
		Init = Init;
		Service = service.HttpService;
		CheckHttp = function()
			local y,n = pcall(function()
				local hs = service.HttpService
				local get = hs:GetAsync('http://google.com')
			end)
			if y and not n then return true end
		end;
		
		Trello = {
			Helpers = {};
			Moderators = {};
			Admins = {};
			Owners = {};
			Creators = {};
			Mutes = {};
			Bans = {};
			Music = {};
			Agents = {};
			Blacklist = {};
			Whitelist = {};
			PerformedCommands = {};
			
			Update = function()
				if not HTTP.CheckHttp() then 
					--HTPP.Trello.Bans = {'Http is not enabled! Cannot connect to Trello!'}
					warn('Http is not enabled! Cannot connect to Trello!')
				elseif not Settings.Trello_Enabled then
					-- Do something else?
				else
					local boards = {}
					local bans = {}
					local admins = {}
					local mods = {}
					local owners = {}
					local helpers = {}
					local creators = {}
					local agents = {}
					local music = {}
					local mutes = {}
					local perms = {}
					local blacklist = {}
					local whitelist = {}
					
					local function grabData(board)
						local trello = HTTP.Trello.API(Settings.Trello_AppKey,Settings.Trello_Token)
						local lists = trello.getLists(board)
						local banList = trello.getListObj(lists,{"Banlist","Ban List","Bans"})
						local commandList = trello.getListObj(lists,{"Commands","Command List"})
						local adminList = trello.getListObj(lists,{"Admins","Admin List","Adminlist"})
						local modList = trello.getListObj(lists,{"Moderators","Moderator List","Moderatorlist","Modlist","Mod List","Mods"})
						local creatorList = trello.getListObj(lists,{"Creators","Creator List","Creatorlist","Place Owners"})
						local ownerList = trello.getListObj(lists,{"Owners","Owner List","Ownerlist"})
						local musicList = trello.getListObj(lists,{"Music","Music List","Musiclist","Songs"}) 
						local permList = trello.getListObj(lists,{"Permissions","Permission List","Permlist"})
						local muteList = trello.getListObj(lists,{"Mutelist","Mute List"})
						local agentList = trello.getListObj(lists,{"Agents","Agent List","Agentlist"})
						local bList = trello.getListObj(lists,"Blacklist")
						local wList = trello.getListObj(lists,"Whitelist")
						
						if banList then
							local cards = trello.getCards(banList.id)
							for l,k in pairs(cards) do
								table.insert(bans,k.name)
							end
						end
						
						if creatorList then
							local cards = trello.getCards(creatorList.id)
							for l,k in pairs(cards) do
								table.insert(creators,k.name)
							end
						end
						
						if modList then
							local cards = trello.getCards(modList.id)
							for l,k in pairs(cards) do
								table.insert(mods,k.name)
							end
						end
						
						if adminList then
							local cards = trello.getCards(adminList.id)
							for l,k in pairs(cards) do
								table.insert(admins,k.name)
							end
						end
						
						if ownerList then
							local cards = trello.getCards(ownerList.id)
							for l,k in pairs(cards) do
								table.insert(owners,k.name)
							end
						end
						
						if agentList then
							local cards = trello.getCards(agentList.id)
							for l,k in pairs(cards) do
								table.insert(agents,k.name)
							end
						end
						
						if musicList then
							local cards = trello.getCards(musicList.id)
							for l,k in pairs(cards) do
								if k.name:match('^(.*):(.*)') then
									local a,b=k.name:match('^(.*):(.*)')
									table.insert(music,{Name = a,ID = tonumber(b)})
								end
							end
						end
						
						if muteList then		
							local cards = trello.getCards(muteList.id)
							for l,k in pairs(cards) do
								table.insert(mutes,k.name)
							end
						end
						
						if bList then		
							local cards = trello.getCards(bList.id)
							for l,k in pairs(cards) do
								table.insert(blacklist,k.name)
							end
						end
						
						if wList then		
							local cards = trello.getCards(wList.id)
							for l,k in pairs(cards) do
								table.insert(whitelist,k.name)
							end
						end
						
						if permList then
							local cards = trello.getCards(permList.id)
							for l,k in pairs(cards) do
								local com,level = k.name:match("^(.*):(.*)") 
								if com and level then 
									Admin.SetPermission(com,level) 
								end
							end
						end
						
						if commandList then
							local cards = trello.getCards(commandList.id)
							for l,k in pairs(cards) do
								if not HTTP.Trello.PerformedCommands[tostring(k.id)] then
									local cmd = k.name
									local placeid
									if cmd:sub(1,1)=="$" then
										placeid = cmd:sub(2):match(".%d+")
										cmd = cmd:sub(#placeid+2)
										placeid = tonumber(placeid)
									end
									if placeid and game.PlaceId~=placeid then return end
									Admin.RunCommand(cmd)
									HTTP.Trello.PerformedCommands[tostring(k.id)] = true 
									Logs.AddLog(Logs.Script,{
										Text = "Trello command executed";
										Desc = cmd;
									})
									if Settings.Trello_Token ~= "" then
										pcall(trello.makeComment,k.id,"Ran Command: "..cmd.."\nPlace ID: "..game.PlaceId.."\nServer Job Id: "..game.JobId.."\nServer Players: "..#service.GetPlayers().."\nServer Time: "..service.GetTime())
									end
								end
							end
						end
					end
					
					for i,v in pairs(Settings.Trello_Secondary) do table.insert(boards,v) end
					if Settings.Trello_Primary~="" then table.insert(boards,Settings.Trello_Primary) end
					for i,v in pairs(boards) do pcall(grabData,v) end
					
					if #bans>0 then HTTP.Trello.Bans = bans end
					if #creators>0 then HTTP.Trello.Creators = creators end
					if #admins>0 then HTTP.Trello.Admins = admins end
					if #mods>0 then HTTP.Trello.Moderators = mods end
					if #owners>0 then HTTP.Trello.Owners = owners end
					if #music>0 then HTTP.Trello.Music = music end
					if #mutes>0 then HTTP.Trello.Mutes = mutes end
					if #agents>0 then HTTP.Trello.Agents = agents end
					if #blacklist>0 then HTTP.Trello.Blacklist = blacklist end
					if #whitelist>0 then HTTP.Trello.Whitelist = whitelist end
					
					for i,v in pairs(service.GetPlayers()) do
						local Banned = Admin.CheckBan(v)
						if Banned[1] then
							v:Kick(Banned[2])
						end 
						
						if v and v.Parent then
							for ind,admin in pairs(HTTP.Trello.Mutes) do
								if Admin.DoCheck(v,admin) then
									Remote.LoadCode(v,[[service.StarterGui:SetCoreGuiEnabled("Chat",false) client.Variables.ChatEnabled = false client.Variables.Muted = true]])
								end
							end
						end
						
						Admin.UpdateCachedLevel(v)
					end
					
					Logs.AddLog(Logs.Script,{
						Text = "Updated Trello Data";
						Desc = "Data was retreived from Trello";
					}) 
				end
			end;
			
			CheckAgent = function(p)
				for ind,v in pairs(HTTP.Trello.Agents) do
					if Admin.DoCheck(p,v) then
						return true
					end
				end
			end;
		};
	};
end
