public async void LeaveQueue(Discord.User user) { SettingsRepo settingsRepo = new SettingsRepo(new SettingsContext()); foreach (Discord.Server server in BotUser.Servers) { if (settingsRepo.lfgStatus(server.Id)) { var channel = server.GetChannel(settingsRepo.GetLfgChannel(server.Id)); bool found = false; foreach (var message in channel.Messages) { if (message.Text.Contains(user.ToString())) { await message.Delete(); } } } } }
public async void QueuePerson(Summoner summoner, Discord.User user, Discord.Server currentserver, string queue) { SettingsRepo settingsRepo = new SettingsRepo(new SettingsContext()); string queuemessage = "***" + user + " from " + currentserver.Name + " queued up for " + queue + " as: ***\n"; queuemessage += new User.SummonerInfo(commands).GetInfoShort(summoner); foreach (Discord.Server server in BotUser.Servers) { if (settingsRepo.lfgStatus(server.Id)) { var channel = server.GetChannel(settingsRepo.GetLfgChannel(server.Id)); bool found = false; foreach (var message in channel.DownloadMessages(100).Result) { if (message.Text.Contains(user.ToString())) { found = true; } } if (found == false) { await channel.SendMessage(queuemessage); } } else if (server.Id == DiscordIds.AtlasId) { foreach (var channel in server.TextChannels) { if (channel.Name.ToLower().Contains(summoner.Region.ToString().ToLower()) && channel.Name.ToLower().Contains("queue")) { await channel.SendMessage(queuemessage); } } } } }
public override string ToString() { return(User.ToString()); }