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 static EmbedBuilder BoxListEmbed(List <LootBox> boxes, IUser author) { var eb = new EmbedBuilderPrepared(author); string gstr = ""; string lstr = ""; for (int i = 0; i < boxes.Count; i++) { var box = LootboxStats.Lootboxes[boxes[i].Type]; string field = $"`#{i+1}` {box.Emote} {box.Name} - **x{boxes[i].Amount}**\n"; if (boxes[i].GuildId == 0) { gstr += field; } else { lstr += field; } } if (gstr != "") { eb.AddField("Global", gstr); } if (lstr != "") { eb.AddField("Local", lstr); } eb.WithFooter("Try the `lootboxstats` command"); return(eb); }
public static EmbedBuilder ListMarriageEmbed(List <Marriage> marriages, IUser author) { var eb = new EmbedBuilderPrepared(author); string list = ""; int i = 1; foreach (var x in marriages) { list += $"`#{i++}` {BasicUtil.IdToMention(GetWifeId(x, author.Id))}\n"; } eb.AddField("User List <:MiaHug:536580304018735135>", list); return(eb); }
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 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 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 BanroyaleDetailsEmbed(Banroyale banroyale, SocketRole role, SocketRole reqRole, int userCount = 0) { string desc = ""; if (banroyale.BanLengthHours > 0) { desc += $":calendar_spiral: Ban Length: *{banroyale.BanLengthHours} hours.*\n"; } if (banroyale.Kick) { desc += $":hiking_boot: Losers kicked.\n"; } if (banroyale.RewardPool > 0) { desc += $"<:toastie3:454441133876183060> Reward Pool: **{banroyale.RewardPool}**\n"; } if (banroyale.RoleReqId != 0) { desc += $":star: Required Role: **{reqRole.Mention}**\n"; } desc += $":star: Participant Role: **{role.Mention}**\n"; desc += $":hammer: Participants: "; if (banroyale.MinParticipants > 0) { desc += $"`Min: {banroyale.MinParticipants}` "; } if (banroyale.MaxParticipants > 0) { desc += $"`Max: {banroyale.MaxParticipants}` "; } desc += $"`Current: {userCount}`\n"; desc += $":star2: Number of winners: **{banroyale.WinnerAmount}**\n"; desc += $"\n:timer: Message frequency: **{banroyale.MinFrequency} - {banroyale.MaxFrequency} seconds**"; var eb = new EmbedBuilderPrepared(desc) .WithTitle("Ban Royale"); return(eb); }
public async Task Status() { var shards = Context.Client.Shards; var eb = new EmbedBuilderPrepared(); int homeShard = -1; if (Context.Guild != null) { homeShard = (int)(Context.Guild.Id << 22) % Context.Client.Shards.Count; } foreach (var shard in shards) { eb.AddField($"Shard {shard.ShardId}{(shard.ShardId == homeShard ? " - your shard" : "")}", $"State: {shard.ConnectionState}\n" + $"Latency: {shard.Latency}\n", true); } 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 async Task ListDisabledCommands([Remainder] string name = "") { string modules = "-"; string commands = "-"; if (DisabledCommandHandler.DisabledCommands.TryGetValue(Context.Guild.Id, out var set) && set.Any()) { commands = string.Join(" | ", set); } if (DisabledCommandHandler.DisabledModules.TryGetValue(Context.Guild.Id, out set) && set.Any()) { modules = string.Join(" | ", set); } var eb = new EmbedBuilderPrepared(Context.User); eb.AddField("Disabled Modules", modules); eb.AddField("Disabled Commands", commands); if (DisabledCommandHandler.DisabledImages.Contains(Context.Guild.Id)) { eb.AddField("Reaction Images", "All Disabled"); } await ReplyAsync(embed : eb.Build()); }
public static EmbedBuilder BoxStatsEmbed(IUser author = null) { var eb = new EmbedBuilderPrepared(author); string str = ""; foreach (var item in LootboxStats.Lootboxes) { var box = item.Value; str += $"**Waifu Chance**:\n"; foreach (var w in box.WaifuChance) { str += $" T{w.Key} - *{w.Value}%*\n"; } str += $"**Toastie Chance**:\n"; str += $" Chance: *{box.ToastieChance}%*\n"; str += $" Amount: *{box.ToastiesFrom} - {box.ToastiesTo}*\n"; eb.AddField($"{box.Emote} {box.Name}", str, true); str = ""; } 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."); } } }