public async Task BulkUpdateSheet(CommandContext ctx, string clanTag) { var roles = ctx.Member.Roles.ToList(); var verification = await IsVerifiedAsync(ctx, true); var clan = await GetClanFromTagOrNameAsync(ctx, clanTag); clanTag = clanTag.ToLower(); if (clan != null && verification == ErrorCode.Qualify && !string.IsNullOrEmpty(clan.details.Tag)) { TimeSpan t = TimeSpan.FromSeconds(5 * clan.members.SpreadsheetUsers.Count); var discordEmbed = Core.Discord.CreateFancyMessage(DiscordColor.Orange, "Bulk Updating", "Updating every element in spreadsheet...", new List <Field>() { new Field("Time Left", t.ToString(@"mm\:ss")) }); DiscordMessage msg = await ctx.RespondAsync(discordEmbed); await SpreadsheetTools.BulkUpdate(clan, new () { msg }, BulkUpdateSheetProgress); discordEmbed = Core.Discord.CreateFancyMessage(clan.details.DiscordColour, "Done", string.Format("Successfully bulk updated {0} members", clan.members.BungieUsers.Count)); await msg.ModifyAsync(discordEmbed); await ThankUsage(ctx, clan, 100); } }
public static async Task BulkUpdate(Clan clan) { List <DiscordMessage> messages = new List <DiscordMessage>(); var discordEmbed = Core.Discord.CreateFancyMessage(DiscordColor.Orange, "Bulk updating " + clan.details.Name + "."); Core.Discord.updatesChannels.ForEach(channel => { messages.Add(Core.Discord.SendFancyMessage(channel, discordEmbed).Result); }); //Console.WriteLine("Bulk updating for " + clan.details.BungieNetName); await SpreadsheetTools.BulkUpdate(clan, messages, BulkUpdateSheetProgress); discordEmbed = Core.Discord.CreateFancyMessage(DiscordColor.SpringGreen, "Bulk updated " + clan.details.Name, "Updated every cell in spreadsheet."); messages.ForEach(async message => { await message.ModifyAsync(discordEmbed); }); }