return function()local Q,T,S,w,t,j,A,V,D,q local function y()Q=server.Functions T=server.Admin S=server.Anti w=server.Core t=server.HTTP j=server.Logs A=server.Remote V=server.Process D=server.Variables q=server.Settings j: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=y,Service=service.HttpService,CheckHttp=function()local Q,T=pcall(function()local Q=service.HttpService local T=Q:GetAsync("\104\116\116\112\058\047\047\103\111\111\103\108\101\046\099\111\109")end)if Q and not T then return true end end;Trello={Helpers={};Moderators={};Admins={},Owners={};Creators={},Mutes={},Bans={};Music={},Agents={};Blacklist={};Whitelist={};PerformedCommands={},Update=function()if not t.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 q.Trello_Enabled then else local Q={}local S={}local w={}local V={}local D={}local y={}local Y={}local k={}local r={}local n={}local G={}local h={}local b={}local function v(Q)local A=t.Trello.API(q.Trello_AppKey,q.Trello_Token)local y=A.getLists(Q)local G=A.getListObj(y,{"\066\097\110\108\105\115\116";"\066\097\110 \076\105\115\116","\066\097\110\115"})local v=A.getListObj(y,{"\067\111\109\109\097\110\100\115","\067\111\109\109\097\110\100 \076\105\115\116"})local U=A.getListObj(y,{"\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 p=A.getListObj(y,{"\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 P=A.getListObj(y,{"\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=A.getListObj(y,{"\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 H=A.getListObj(y,{"\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 X=A.getListObj(y,{"\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 f=A.getListObj(y,{"\077\117\116\101\108\105\115\116";"\077\117\116\101 \076\105\115\116"})local J=A.getListObj(y,{"\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 R=A.getListObj(y,"\066\108\097\099\107\108\105\115\116")local C=A.getListObj(y,"\087\104\105\116\101\108\105\115\116")if G then local Q=A.getCards(G.id)for Q,T in pairs(Q)do table.insert(S,T.name)end end if P then local Q=A.getCards(P.id)for Q,T in pairs(Q)do table.insert(Y,T.name)end end if p then local Q=A.getCards(p.id)for Q,T in pairs(Q)do table.insert(V,T.name)end end if U then local Q=A.getCards(U.id)for Q,T in pairs(Q)do table.insert(w,T.name)end end if x then local Q=A.getCards(x.id)for Q,T in pairs(Q)do table.insert(D,T.name)end end if J then local Q=A.getCards(J.id)for Q,T in pairs(Q)do table.insert(k,T.name)end end if H then local Q=A.getCards(H.id)for Q,T in pairs(Q)do if T.name:match("\094\040\046\042\041\058\040\046\042\041")then local Q,S=T.name:match("\094\040\046\042\041\058\040\046\042\041")table.insert(r,{Name=Q,ID=tonumber(S)})end end end if f then local Q=A.getCards(f.id)for Q,T in pairs(Q)do table.insert(n,T.name)end end if R then local Q=A.getCards(R.id)for Q,T in pairs(Q)do table.insert(h,T.name)end end if C then local Q=A.getCards(C.id)for Q,T in pairs(Q)do table.insert(b,T.name)end end if X then local Q=A.getCards(X.id)for Q,S in pairs(Q)do local w,t=S.name:match("\094\040\046\042\041\058\040\046\042\041")if w and t then T.SetPermission(w,t)end end end if v then local Q=A.getCards(v.id)for Q,S in pairs(Q)do if not t.Trello.PerformedCommands[tostring(S.id)]then local Q=S.name local w if Q:sub(1,1)=="\036"then w=(Q:sub(2)):match("\046\037\100\043")Q=Q:sub(#w+2)w=tonumber(w)end if w and game.PlaceId~=w then return end T.RunCommand(Q)t.Trello.PerformedCommands[tostring(S.id)]=true j.AddLog(j.Script,{Text="\084\114\101\108\108\111 \099\111\109\109\097\110\100 \101\120\101\099\117\116\101\100",Desc=Q})if q.Trello_Token~=""then pcall(A.makeComment,S.id,"\082\097\110 \067\111\109\109\097\110\100\058 "..(Q..("\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 T,S in pairs(q.Trello_Secondary)do table.insert(Q,S)end if q.Trello_Primary~=""then table.insert(Q,q.Trello_Primary)end for Q,T in pairs(Q)do pcall(v,T)end if#S>0 then t.Trello.Bans=S end if#Y>0 then t.Trello.Creators=Y end if#w>0 then t.Trello.Admins=w end if#V>0 then t.Trello.Moderators=V end if#D>0 then t.Trello.Owners=D end if#r>0 then t.Trello.Music=r end if#n>0 then t.Trello.Mutes=n end if#k>0 then t.Trello.Agents=k end if#h>0 then t.Trello.Blacklist=h end if#b>0 then t.Trello.Whitelist=b end for Q,S in pairs(service.GetPlayers())do local w=T.CheckBan(S)if w[1]then S:Kick(w[2])end if S and S.Parent then for Q,w in pairs(t.Trello.Mutes)do if T.DoCheck(S,w)then A.LoadCode(S,"\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 T.UpdateCachedLevel(S)end j.AddLog(j.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(Q)for S,w in pairs(t.Trello.Agents)do if T.DoCheck(Q,w)then return true end end end}}end
--// HTTP
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
