private async void Load() { Logger.Info("[Managers] Loading in all managers, one moment please..."); var loaded = 0; foreach (var type in Assembly.GetExecutingAssembly().GetExportedTypes()) { if (type.BaseType == null) { continue; } if (!type.BaseType.IsGenericType) { continue; } var generic = type.BaseType.GetGenericTypeDefinition(); if (generic != typeof(Manager <>) || type == typeof(Manager <>)) { continue; } LoadManager(type); loaded++; } foreach (var manager in Managers) { var method = manager.Key.GetMethod("Begin", BindingFlags.Public | BindingFlags.Instance); method?.Invoke(manager.Value, null); } Logger.Info($"[Managers] Successfully loaded in {loaded} manager(s)!"); AttachTickHandler(SaveTask); EventRegistry["rconCommand"] += new Action <string, List <object> >(OnRconCommand); EventRegistry["chat:global"] += new Action <ExpandoObject>(options => new List <Player>(new PlayerList()).ForEach(self => self.TriggerEvent("chat:addMessage", options))); EventSystem.GetModule().Attach("event:global", new EventCallback(metadata => { foreach (var user in ActiveUsers) { user.Send(metadata.Find <string>(0), metadata.AsEnumerable().Skip(1).ToArray()); } return(null); })); EventSystem.GetModule().Attach("report:create", new AsyncEventCallback(async metadata => { var user = ActiveUsers.FirstOrDefault(self => self.Handle == metadata.Sender); if (user == null) { return(null); } var id = TagId.Generate(5); var embeds = new JsonBuilder().Add("_", new Dictionary <string, object> { ["color"] = "32960", ["title"] = $"{metadata.Find<string>(0)} . {metadata.Find<string>(1)}", ["description"] = string.Join("\n", $"{metadata.Find<string>(2)}", "", $"● CitizenFX.Log [`View`](https://societyrp.se/reports/{id}/log)", $"● Report ID [`{id}`](https://societyrp.se/reports/{id})", $"● Användare `{user.Seed}`" ), ["footer"] = new Dictionary <string, object>() { ["text"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") }, ["url"] = "https://societyrp.se" }); var data = new JsonBuilder().Add("content", "").Add("username", $"Report System | {id}") .Add("embeds", embeds.ToCollection()).Build(); await RequestHttp( "https://discordapp.com/api/webhooks/551205130272374802/xMk9kdI3TpbEh-7pNSfUOICpYhjZDOfdQ5WC75Pop6kAFDwHrmpAOlgmDjZ7dwnRSPCA", data, new Dictionary <string, string> { ["Length"] = data.Length.ToString(), ["Content-Type"] = "application/json" }); return(null); })); }