public static bool AddInSociety(SocUser sUser) { Resident newResident = new Resident(); bool result = newResident.AddSocietyUser(mUser.UserID, sUser.FlatId, sUser.SocietyId); return(result); }
public static async Task LiveEvent() { System.Threading.Thread.Sleep(5000); while (true) { Shared.ConfigHandler.LoadConfig(); bool IsLive = TwitchBot.Commands.Drops.IsLive(); if (StreamLive != IsLive && UserList.Count != 0) { StreamLive = IsLive; TimeSpan TSPan = (TimeSpan)(DateTime.Now - DateTime.Parse(Shared.ConfigHandler.Config["Notifications"]["LastLive"].ToString())); if (StreamLive && (int)Math.Floor(TSPan.TotalMinutes) >= int.Parse(Shared.ConfigHandler.Config["Notifications"]["MinimumDownTime"].ToString())) { foreach (Newtonsoft.Json.Linq.JToken User in Shared.ConfigHandler.Config["Notifications"]["DiscordUsers"]) { foreach (SocketGuildUser SocUser in UserList) { if (SocUser.Id.ToString() == User.ToString()) { try { Discord.IDMChannel DM = await SocUser.GetOrCreateDMChannelAsync(); await DM.SendMessageAsync(Shared.ConfigHandler.Config["Notifications"]["DiscordMessage"].ToString()); } catch { } break; } } } } } if (IsLive) { Shared.ConfigHandler.Config["Notifications"]["LastLive"] = DateTime.Now.ToString(); Shared.ConfigHandler.SaveConfig(); } System.Threading.Thread.Sleep(60000); } }