public async Task RoleShopRemoveRole([Remainder] string name = "") { var roles = await ShopRoleDb.GetRoles(Context.Guild.Id); var eb = new EmbedBuilderPrepared() .WithTitle(":star: Role Shop"); if (!roles.Any()) { await Context.Channel.SendMessageAsync(embed : eb.WithDescription(" *~ No roles in shop ~*\n").WithColor(Color.DarkRed).Build()); return; } int i = 1; var role = await this.SelectItem( roles, eb.WithDescription( "Enter the number of the role you wish to delete...\n\n" + CustomPaginatedMessage.PagesArray(roles, 100, (r) => $"**#{i++}** <@&{r.RoleId}>\n", false).First() ) ); await ShopRoleDb.RemoveRole(role.RoleId); await Context.Channel.SendMessageAsync(embed : eb.WithDescription($" *~ <@&{role.RoleId}> removed ~*\n").Build()); }
public async Task RoleShop([Remainder] string str = "") { var roles = await ShopRoleDb.GetRoles(Context.Guild.Id); var eb = new EmbedBuilderPrepared() .WithTitle(":star: Role Shop"); if (!roles.Any()) { await Context.Channel.SendMessageAsync(embed : eb.WithDescription(" *~ No roles in shop ~*\n").WithColor(Color.DarkRed).Build()); return; } await Context.Channel.SendMessageAsync(embed : eb.WithDescription(CustomPaginatedMessage.PagesArray(roles.OrderByDescending(x => x.Price), 100, (r) => $"<@&{r.RoleId}> - **{r.Price:n0}**\n").First()).Build()); }
public static EmbedBuilder ListAllEmbed(List <ImageCount> images, string prefix = "!", IUser author = null) { var eb = new EmbedBuilderPrepared(author); eb.WithDescription($"<:Awooo:582888496793124866> `{prefix}pat` - use reaction images!\n" + $"<:NadeYay:564880253382819860> `{prefix}album pat` - link to an imgur album with all the images!\n" + $"<:KannaHype:571690048001671238> `{prefix}i 20` - use a specific reaction image by id!"); if (images.Any(x => x.Count >= 20)) { string list = ""; foreach (var x in images.Where(x => x.Count >= 20)) { list += "`" + x.ToString() + "` "; } eb.AddField("20+ images", list); } if (images.Any(x => x.Count >= 10 && x.Count < 20)) { string list = ""; foreach (var x in images.Where(x => x.Count >= 10 && x.Count < 20)) { list += "`" + x.ToString() + "` "; } eb.AddField("10+ images", list); } if (images.Any(x => x.Count >= 5 && x.Count < 10)) { string list = ""; foreach (var x in images.Where(x => x.Count >= 5 && x.Count < 10)) { list += "`" + x.ToString() + "` "; } eb.AddField("5+ images", list); } if (images.Any(x => x.Count > 0 && x.Count < 5)) { string list = ""; foreach (var x in images.Where(x => x.Count >= 1 && x.Count < 5)) { list += "`" + x.ToString() + "` "; } eb.AddField("<5 images", list); } return(eb); }
public async Task AutocompleteWaifu([Remainder] string name) { await Context.Channel.TriggerTypingAsync(); var eb = new EmbedBuilderPrepared(Context.User); var waifus = await WebUtil.GetWaifus(name); string list = ""; foreach (var w in waifus.Results.Take(10)) { list += $"`{w.MalId}` [{w.Name}]({w.URL}) - *{(w.Animeography.FirstOrDefault() == null ? w.Mangaography.FirstOrDefault().Name : w.Animeography.FirstOrDefault().Name)}*\n"; } eb.WithDescription(list); await Context.Channel.SendMessageAsync(embed : eb.Build()); }
public static EmbedBuilder BoxShopEmbed(IUser author) { var eb = new EmbedBuilderPrepared(author); string str = ""; int count = 0; foreach (var item in LootboxStats.Lootboxes) { var box = item.Value; if (box.Price >= 0) { string emote = box.Emote == null ? "" : box.Emote == "" ? "" : box.Emote + " "; str += $"{++count}. {emote}{box.Name} - **{box.Price}** {RandomEmote()}\n"; } } eb.WithFooter("Try the `lootboxstats` command"); eb.WithAuthor("Lootbox Shop", author.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-lootbox")); eb.AddField("Lootboxes", str); eb.WithDescription("`!bl` to buy a lootbox!"); return(eb); }
public static async Task Timer_RequestSauce(object sender, ElapsedEventArgs e) { Waifu waifu = null; List <Embed> embeds = new List <Embed>(); SauceRequest req = null; if (sender != null && sender is SauceRequest) { req = sender as SauceRequest; waifu = req.Waifu; } try { using var db = new NamikoDbContext(); if (waifu != null) { waifu = await db.Waifus.AsQueryable().FirstOrDefaultAsync(x => x.Source.Equals(waifu.Source) && x.ImageSource.Equals("missing")); } if (waifu == null) { waifu = await db.Waifus.AsQueryable().OrderBy(x => Guid.NewGuid()).FirstOrDefaultAsync(x => x.ImageSource.Equals("missing")); if (waifu == null) { await WebhookClients.SauceRequestChannel.SendMessageAsync("`No unknown sauces. Idling...`"); return; } } embeds.Add(WaifuUtil.WaifuEmbedBuilder(waifu).Build()); var res = await WebUtil.SauceNETSearchAsync(waifu.HostImageUrl); if (res.Message.Contains("limit exceeded", StringComparison.OrdinalIgnoreCase)) { Console.WriteLine("Sauce limit exceeded"); } else { embeds.Add(WebUtil.SauceEmbed(res, waifu.HostImageUrl).Build()); } var family = await db.Waifus.AsQueryable().Where(x => x.Source.Equals(waifu.Source) && !(x.ImageSource == null || x.ImageSource.Equals("retry") || x.ImageSource.Equals("missing"))).ToListAsync(); family = family.DistinctBy(x => x.ImageSource).ToList(); string familySauces = ""; foreach (var w in family) { string add = $"**{w.Name}** - {w.ImageSource}\n"; if ((familySauces + add).Length < 1900) { familySauces += add; } } if (familySauces != "") { var eb = new EmbedBuilderPrepared(); eb.WithTitle("Possible sauces"); eb.WithDescription($"Image sauces of waifus from **{waifu.Source}**:\n{familySauces}"); embeds.Add(eb.Build()); } if (req == null || req.Channel == null) { await WebhookClients.SauceRequestChannel.SendMessageAsync("Missing waifu image sauce", embeds : embeds); } else { foreach (var embed in embeds) { await req.Channel.SendMessageAsync(embed : embed); } } } catch (Exception ex) { SentrySdk.WithScope(scope => { if (waifu != null) { scope.SetExtras(waifu.GetProperties()); } SentrySdk.CaptureException(ex); }); if (req == null || req.Channel == null) { await WebhookClients.SauceRequestChannel.SendMessageAsync($"Broke on **{waifu.Name}** - please find source manually."); } else { await req.Channel.SendMessageAsync($"Broke on **{waifu.Name}** - please find source manually."); } } }