public async Task GetOrder(string playerInGameName) { var finalOrders = AnzacSpiritService.GetWarOrdersSortedByDiscordUser(); var playerDiscords = DbService.GetInGamePlayerDiscordLinks(); var playerId = playerDiscords.First(x => x.InGameName.Trim().ToLower() == playerInGameName.Trim().ToLower()).DiscordId; var embed = AnzacSpiritService.GetPlayerOrdersEmbed(finalOrders.First(x => x.Key == playerId)); await ReplyAsync(embed : embed); }
public async Task SendOrder(string playerInGameName) { var finalOrders = AnzacSpiritService.GetWarOrdersSortedByDiscordUser(); var playerDiscords = DbService.GetInGamePlayerDiscordLinks(); // TODO: Refactor this searching for id var playerId = playerDiscords.First(x => x.InGameName.Trim().ToLower() == playerInGameName.Trim().ToLower()).DiscordId; var user = Context.Guild.Users.First(x => x.Id == playerId); var embed = AnzacSpiritService.GetPlayerOrdersEmbed(finalOrders.First(x => x.Key == playerId)); await DiscordUtilities.DirectMessageUserAsync(embed, user); }
public async Task SendOrders() { var finalOrders = AnzacSpiritService.GetWarOrdersSortedByDiscordUser(); // DM to each user foreach (var finalOrder in finalOrders) { var user = Context.Guild.Users.FirstOrDefault(x => x.Id == finalOrder.Key); if (user == null) { await ReplyNewEmbed($"No user found for {finalOrder.Value[0].Item2.Player}", Color.Red); return; } var embed = AnzacSpiritService.GetPlayerOrdersEmbed(finalOrder); await DiscordUtilities.DirectMessageUserAsync(embed, user); } await ReplyNewEmbed("Success", Color.Purple); }