public override async Task BuildAsync() { Outcome = Outcome == WheelExtension.Outcome.Task ? WheelExtension.Outcome.Edge : Outcome; var denialtext = "please don't break the Bot"; switch (Outcome) { case WheelExtension.Outcome.Edge: denialtext = "Then spin again"; this.Outcome = WheelExtension.Outcome.Edge; break; case WheelExtension.Outcome.Denial: denialtext = "deny your o****m"; this.DenialTime = new TimeSpan(8, 0, 0); this.Outcome = WheelExtension.Outcome.Denial; break; case WheelExtension.Outcome.Ruin: denialtext = "ruin your o****m"; this.Outcome = WheelExtension.Outcome.Ruin; break; case WheelExtension.Outcome.O****m: denialtext = "enjoy a full o****m"; this.Outcome = WheelExtension.Outcome.O****m; break; case WheelExtension.Outcome.Denial | WheelExtension.Outcome.Edge: var chance = Helpers.RandomGenerator.RandomInt(0, 9); if (chance < 5) { denialtext = "deny your o****m"; this.DenialTime = new TimeSpan(8, 0, 0); this.Outcome = WheelExtension.Outcome.Denial; } else { denialtext = "Then spin again. If you cum/ruin, use ``//came`` or ``//ruined``"; this.Outcome = WheelExtension.Outcome.Edge; } break; } Link link = null; if (this.Outcome == WheelExtension.Outcome.Edge) { Image = _dependencies.WaifuJoiBot.GetRandomPicture(); HttpClient client = new HttpClient(); var response = client.GetAsync(WaifuJOIBot.GetCreatorUrl(Image.CreatorId)).GetAwaiter().GetResult(); var creator = await MessagePack.MessagePackSerializer.DeserializeAsync <WaifuJoi.Shared.Models.Creator>( await response.Content.ReadAsStreamAsync()); link = new Link { CreatorName = creator.Name, Url = WaifuJOIBot.GetImageUrl(Image.Id), Type = Link.ContentType.Picture }; } else { List <Link> links = await Link.LoadAll(); var randomLinkNr = Helpers.RandomGenerator.RandomInt(0, links.Count); if (links.Count <= randomLinkNr) { link = new Link() { CreatorName = "Salem forgot to update the Links again...", FileName = "Salem forgot to update the Links again...", Type = Link.ContentType.Picture, Url = "https://Exception.com" }; } else { link = links[randomLinkNr]; } } var fullSentence = string.Empty; var rerollIn = string.Empty; switch (link.Type) { case Link.ContentType.Video: fullSentence = $"Watch {link.CreatorName}' JOI. {denialtext}"; break; case Link.ContentType.Picture: if (Outcome == WheelExtension.Outcome.Edge) { fullSentence = $"Edge to {link.CreatorName}'s Picture and take a 30 second break. {denialtext}"; rerollIn = "Don't forget to take a break! If you cum/ruin, use ``//came`` or ``//ruined``"; this.WheelLockedTime = new TimeSpan(0, 0, 30); } else { fullSentence = $"Edge to {link.CreatorName}'s Picture and {denialtext}"; } break; } if (this.Outcome != WheelExtension.Outcome.Edge) { rerollIn = "You are not allowed to re-roll for now."; this.WheelLockedTime = new TimeSpan(8, 0, 0); } this.Text = $"{fullSentence}.{rerollIn}\n" + $"{link.Url}\n"; var builder = new DiscordEmbedBuilder { Title = "Click here.", Description = fullSentence, Footer = new DiscordEmbedBuilder.EmbedFooter() { Text = rerollIn }, Url = link.Url, Color = link.Type == Link.ContentType.Picture ? new DiscordColor("#42f483") : new DiscordColor("#acf441"), Author = new DiscordEmbedBuilder.EmbedAuthor() { Name = link.CreatorName } }; if (link.Type == Link.ContentType.Picture) { builder.ImageUrl = link.Url; } this.Embed = builder.Build(); }
public override async Task BuildAsync() { Outcome = Outcome == UserSetting.Outcome.Task ? UserSetting.Outcome.Edge : Outcome; var denialText = GetDenialText(); Link link = null; if (this.Outcome == UserSetting.Outcome.Edge) { Image = await((WaifuJOIBot)_services.GetService(typeof(WaifuJOIBot))).GetRandomPicture(); HttpClient client = new HttpClient(); using var response = await client.GetAsync(WaifuJOIBot.GetCreatorUrl(Image.CreatorId)); var creator = await MessagePack.MessagePackSerializer.DeserializeAsync <WaifuJoi.Shared.Features.User.GetUserResponse>( await response.Content.ReadAsStreamAsync()); link = new Link { CreatorName = creator.User.Name, Url = WaifuJOIBot.GetImageUrl(Image.Id), Type = Link.ContentType.Picture }; } else { List <Link> links = await Link.LoadAll(); var randomLinkNr = Helpers.RandomGenerator.RandomInt(0, links.Count); if (links.Count <= randomLinkNr) { link = new Link() { CreatorName = Properties.Resources.ForgotLinkUpdate, FileName = Properties.Resources.ForgotLinkUpdate, Type = Link.ContentType.Picture, Url = Properties.Resources.ForgotLinkUpdate }; } else { link = links[randomLinkNr]; } } var fullSentence = string.Empty; var rerollIn = string.Empty; switch (link.Type) { case Link.ContentType.Video: fullSentence = $"Watch {link.CreatorName}' JOI. {denialText}"; break; case Link.ContentType.Picture: if (Outcome == UserSetting.Outcome.Edge) { fullSentence = $"Edge to {link.CreatorName}'s Picture and take a 30 second break. {denialText}"; rerollIn = "Don't forget to take a break! If you cum/ruin, use ``//came`` or ``//ruined``"; this.WheelLockedTime = new TimeSpan(0, 0, 30); } else { fullSentence = $"Edge to {link.CreatorName}'s Picture and {denialText}"; } break; } if (this.Outcome != UserSetting.Outcome.Edge) { rerollIn = "You are not allowed to re-roll for now."; this.WheelLockedTime = new TimeSpan(8, 0, 0); } this.Text = $"{fullSentence}.{rerollIn}\n" + $"{link.Url}\n"; var builder = new DiscordEmbedBuilder { Title = "Click here.", Description = fullSentence, Footer = new DiscordEmbedBuilder.EmbedFooter() { Text = rerollIn }, Url = link.Url, Color = link.Type == Link.ContentType.Picture ? new DiscordColor("#42f483") : new DiscordColor("#acf441"), Author = new DiscordEmbedBuilder.EmbedAuthor() { Name = link.CreatorName } }; if (link.Type == Link.ContentType.Picture) { builder.ImageUrl = link.Url; } this.Embed = builder.Build(); }