private async Task ReactionIncreaseEvent(IUserMessage message, ISocketMessageChannel channel, SocketReaction reaction, IUser user) { if (!IsDelveMessage(message)) { return; } DelveInfo delve = new DelveInfo().FromMessage(DelveService, message); delve.Ticks += delve.TicksPerProgress; await message.RemoveReactionAsync(reaction.Emote, user).ConfigureAwait(false); await message.ModifyAsync(msg => msg.Embed = delve.BuildEmbed() as Embed); }
public async Task DelveSite() { var delveService = Services.GetRequiredService <DelveService>(); string themeHelperText = string.Empty; string domainHelperText = string.Empty; var builder = new DelveInfoBuilder(delveService, OracleService); for (int i = 0; i < delveService.Themes.Count; i++) { themeHelperText += String.Format(DelveResources.HelperTextFormat, i + 1, delveService.Themes[i].DelveSiteTheme) + "\n"; } themeHelperText += "\n" + String.Format(DelveResources.HelperTextFormat, DelveResources.RandomAliases.Split(',')[0], DelveResources.RandomAliases.Split(',')[1]); for (int i = 0; i < delveService.Domains.Count; i++) { domainHelperText += String.Format(DelveResources.HelperTextFormat, i + 1, delveService.Domains[i].DelveSiteDomain) + "\n"; } domainHelperText += "\n" + String.Format(DelveResources.HelperTextFormat, DelveResources.RandomAliases.Split(',')[0], DelveResources.RandomAliases.Split(',')[1]); var helperMessage = await ReplyAsync(embed : new EmbedBuilder() .WithTitle(DelveResources.ThemeHelperTitle) .WithDescription(themeHelperText) .WithFooter(DelveResources.HelperFooterThemeDomain) .Build()); var themeResponse = await NextMessageAsync(timeout : TimeSpan.FromMinutes(2)); if (themeResponse != null) { builder.WithThemes(themeResponse.Content); await themeResponse.DeleteAsync().ConfigureAwait(false); await helperMessage.ModifyAsync(msg => msg.Embed = new EmbedBuilder() .WithTitle(DelveResources.DomainHelperTitle) .WithDescription(domainHelperText) .AddField(DelveResources.HelperSelectionsTitle, builder) .WithFooter(DelveResources.HelperFooterThemeDomain) .Build()); } else { await helperMessage.ModifyAsync(msg => msg.Embed = helperMessage.Embeds.First().ToEmbedBuilder().WithDescription(DelveResources.UserInputTimeoutError).Build()); return; } var domainResponse = await NextMessageAsync(timeout : TimeSpan.FromMinutes(2)); if (domainResponse != null) { builder.WithDomains(domainResponse.Content); await domainResponse.DeleteAsync().ConfigureAwait(false); await helperMessage.ModifyAsync(msg => msg.Embed = new EmbedBuilder() .WithTitle(DelveResources.HelperSiteNameTitle) .WithDescription(DelveResources.HelperSiteNameText) .AddField(DelveResources.HelperSelectionsTitle, builder) .Build()); } else { await helperMessage.ModifyAsync(msg => msg.Embed = helperMessage.Embeds.First().ToEmbedBuilder().WithDescription(DelveResources.UserInputTimeoutError).Build()); return; } var siteName = await NextMessageAsync(timeout : TimeSpan.FromMinutes(2)); if (siteName != null) { builder.WithName(siteName.Content); await siteName.DeleteAsync().ConfigureAwait(false); await helperMessage.ModifyAsync(msg => msg.Embed = new EmbedBuilder() .WithTitle(DelveResources.HelperSiteObjectiveTitle) .WithDescription(DelveResources.HelperSiteObjectiveText) .AddField(DelveResources.HelperSelectionsTitle, builder) .Build()); } else { await helperMessage.ModifyAsync(msg => msg.Embed = helperMessage.Embeds.First().ToEmbedBuilder().WithDescription(DelveResources.UserInputTimeoutError).Build()); return; } var siteObjective = await NextMessageAsync(timeout : TimeSpan.FromMinutes(2)); if (siteObjective != null) { builder.WithObjective(siteObjective.Content); await siteObjective.DeleteAsync().ConfigureAwait(false); await helperMessage.ModifyAsync(msg => msg.Embed = new EmbedBuilder() .WithTitle(DelveResources.HelperSiteRankTitle) .WithDescription(DelveResources.HelperSiteRankText) .AddField(DelveResources.HelperSelectionsTitle, builder) .Build()); } else { await helperMessage.ModifyAsync(msg => msg.Embed = helperMessage.Embeds.First().ToEmbedBuilder().WithDescription(DelveResources.UserInputTimeoutError).Build()); return; } var siteRank = await NextMessageAsync(timeout : TimeSpan.FromMinutes(2)); if (siteRank == null) { await siteRank.DeleteAsync().ConfigureAwait(false); await helperMessage.ModifyAsync(msg => msg.Embed = helperMessage.Embeds.First().ToEmbedBuilder().WithDescription(DelveResources.UserInputTimeoutError).Build()); return; } builder.WithRank(siteRank.Content); await siteRank.DeleteAsync().ConfigureAwait(false); DelveInfo delve = builder.Build(); await helperMessage.ModifyAsync(msg => { msg.Content = null; msg.Embed = delve.BuildEmbed() as Embed; }); await helperMessage.AddReactionAsync(DecreaseEmoji); await helperMessage.AddReactionAsync(IncreaseEmoji); await helperMessage.AddReactionAsync(FullEmoji); await helperMessage.AddReactionAsync(FeatureEmoji); await helperMessage.AddReactionAsync(DangerEmoji); await helperMessage.AddReactionAsync(RollEmoji); }