public async Task SendAnnouncement(string name, int days) { var eb = await JsonHelper.ReadJson <EmbedBuilder>(Assembly.GetEntryAssembly().Location.Replace(@"Namiko.dll", $@"embeds/{name}")); eb.WithColor(BasicUtil.RandomColor()); using var db = new NamikoDbContext(); var voters = db.Voters.AsQueryable().Where(x => x.Date > DateTime.Now.AddDays(-days)).Select(x => x.UserId).ToHashSet(); int votes = db.Voters.AsQueryable().Where(x => x.Date > DateTime.Now.AddDays(-days)).Count(); await ReplyAsync($"Sending this to {voters.Count} users. Votes - {votes}"); await ReplyAsync(embed : eb.Build()); var client = Program.GetClient(); var embed = eb.Build(); int i = 0; foreach (var id in voters) { try { var ch = await client.GetUser(id).CreateDMChannelAsync(); await ch.SendMessageAsync(embed : embed); i++; } catch { } } await ReplyAsync($"Delivered to {i} users."); }
public EmbedBuilder CommandHelpEmbed(CommandInfo commandInfo) { var eb = new EmbedBuilder(); eb.WithAuthor(commandInfo.Name); string desc = ""; //desc += $"**Name**: {commandInfo.Name}\n"; desc += $"**Aliases**: "; foreach (var x in commandInfo.Aliases) { desc += $"`{x}` "; } desc += "\n"; desc += $"**Description**: {commandInfo.Summary}\n"; desc += $"**Permissions**: "; foreach (var x in commandInfo.Preconditions) { desc += $"{x} "; } eb.WithColor(BasicUtil.RandomColor()); eb.WithDescription(desc); return(eb); }
public async Task TestEmbed(string name) { var eb = await JsonHelper.ReadJson <EmbedBuilder>(Assembly.GetEntryAssembly().Location.Replace(@"Namiko.dll", $@"embeds/{name}")); eb.WithColor(BasicUtil.RandomColor()); await ReplyAsync(embed : eb.Build()); }
public static EmbedBuilder MarriagesEmbed(IUser user, SocketGuild guild) { //embed basics string partners = ""; List <Marriage> marriages = MarriageDb.GetMarriages(user.Id, guild.Id); foreach (Marriage marriage in marriages) { partners += $"{BasicUtil.IdToMention(GetWifeId(marriage, user.Id))} :revolving_hearts: {marriage.Date.ToString("yyyy/MM/dd")}\n"; } //embed EmbedBuilder embed = new EmbedBuilder(); embed.WithColor(ProfileDb.GetHex(out string colour, user.Id) ? (Discord.Color)UserUtil.HexToColor(colour) : BasicUtil.RandomColor()); if (!String.IsNullOrEmpty(partners)) { embed.AddField("Married To", partners, true); try { embed.WithImageUrl(Program.GetClient().GetUser(GetWifeId(marriages[0], user.Id)).GetAvatarUrl()); } catch { } } else { embed.WithDescription("You are not Married."); } embed.WithAuthor(user); return(embed); }
public static EmbedBuilder MangaEmbed(Manga manga) { string MangaState; if (manga.Status == "Publishing") { MangaState = "^"; } else { MangaState = manga.Chapters?.ToString(); } var eb = new EmbedBuilder(); eb.WithColor(BasicUtil.RandomColor()); eb.WithAuthor($"{manga.Title} ({manga.TitleJapanese})", MalIconUrl, manga.LinkCanonical); eb.WithFooter($"Results of manga search"); eb.WithCurrentTimestamp(); string desc = "**Type:** " + manga.Type + "\n**Manga score:** " + manga.Score + "\n**Status:** " + manga.Status + "\n**Chapters:** " + MangaState + "\n**Genres:** " + string.Join('/', manga.Genres) + "\n" + "\n" + manga.Synopsis; eb.WithDescription(desc.Length > 2040 ? desc.Substring(0, 2030) + "..." : desc); eb.ThumbnailUrl = manga.ImageURL; return(eb); }
public static EmbedBuilder DonateEmbed(string prefix) { var eb = new EmbedBuilder(); var client = Program.GetClient(); string desc = "Support the development of Namiko and get rewards!"; eb.WithDescription(desc); string field = ""; field += $"**Namiko Pro** - *5$*\n `{prefix}InfoPro`\n"; field += $"**Namiko Pro+** - *10$*\n `{prefix}InfoProPlus`\n"; eb.AddField("User Upgrades <:Pro:632544044643516416>", field, true); field = ""; field += $"**Pro Guild** - *5$*\n `{prefix}InfoGuild`\n"; field += $"**Pro Guild+** - *10$*\n `{prefix}InfoGuildPlus`\n"; eb.AddField("Server Wide Upgrades <:Guild:632544044660031498>", field, true); field = ""; field += $":star: [Patreon]({LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-pro")}) - includes Pro.\n"; eb.AddField("Donation Links", field); eb.WithAuthor(client.CurrentUser); eb.WithColor(BasicUtil.RandomColor()); eb.WithFooter("-What are you? Twelve?"); eb.WithImageUrl(AppSettings.NamikoBannerUrl); return(eb); }
public static EmbedBuilder InfoEmbed() { var eb = new EmbedBuilder(); var client = Program.GetClient(); string desc = "Discord bot made in C#, featuring innovations like waifu shops, a banroulette, teams and extensive currency and economy features."; eb.WithDescription(desc); string field = "Creator: taiHen#2839\n"; field += $"Support Server: [Namiko Test Realm]({LinkHelper.SupportServerInvite})\n"; field += $"Usage Guide: [Guide]({LinkHelper.Guide})\n"; field += $"Origin Server: [AMFWT]({LinkHelper.AmfwtServerInvite})\n"; field += $"Invite Link: [Namiko]({LinkHelper.GetRedirectUrl(LinkHelper.BotInvite, "BotInvite", "cmd-info")})\n"; field += $"Repository: [Github]({LinkHelper.Repository})\n"; field += $"Get Pro: [Patreon]({LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-info")}) :star:"; eb.AddField("References", field); eb.WithAuthor(client.CurrentUser); eb.WithColor(BasicUtil.RandomColor()); eb.WithFooter("-What are you? Twelve?"); eb.WithImageUrl(AppSettings.NamikoBannerUrl); return(eb); }
// Shop Message generators /*public static EmbedBuilder GetShopEmbed(List<ShopWaifu> waifus, string prefix) { var client = Program.GetClient(); var eb = new EmbedBuilder(); eb.WithAuthor("Waifu Store", client.CurrentUser.GetAvatarUrl()); foreach (var x in waifus) { var efb = new EmbedFieldBuilder{ IsInline = true, Name = x.Waifu.Name, Value = $"TIER: **{x.Waifu.Tier}**\nPrice: {GetPriceString(x.Waifu.Tier, x.Discount)}" }; //efb.IsInline = true; //efb.Name = x.Waifu.Name; //efb.Value = $"TIER: **{x.Waifu.Tier}**\nPrice: {GetPriceString(x.Waifu.Tier, x.Discount)}"; if (x.Limited > -1) { efb.IsInline = false; efb.Value += "\n" + "**Limited!**"; if (x.Limited > 0) efb.Value += $" {x.Limited} in stock!"; else efb.Value += $" OUT OF STOCK! Bought by: {client.GetUser(x.BoughtBy).Mention}"; } eb.AddField(efb); } /////////////////////////// //INSERT THUMBNAIL /////////////////////////// eb.WithFooter($"{prefix}buywaifu [name] | Resets in {23 - DateTime.Now.Hour} Hours {60 - DateTime.Now.Minute} Minutes"); eb.Color = BasicUtil.RandomColor(); return eb; } public static EmbedBuilder WaifuShopEmbed(List<ShopWaifu> waifus, string prefix) { var client = Program.GetClient(); var eb = new EmbedBuilder(); eb.WithAuthor("Waifu Store", client.CurrentUser.GetAvatarUrl()); string list = ""; foreach (var x in waifus) { string src = x.Waifu.Source.Length > 33 ? (x.Waifu.Source.Substring(0, 30) + "...") : x.Waifu.Source; string listing = $"T{x.Waifu.Tier} {GetPriceString(x.Waifu.Tier, x.Discount)}: **{x.Waifu.Name}** - *{src}*\n"; if (x.Limited > -1) { listing += " **-Limited!**"; if (x.Limited > 0) listing += $" {x.Limited} in stock!\n"; else listing += $" OUT OF STOCK! Bought by: {client.GetUser(x.BoughtBy).Mention}\n"; list += listing; } else list += listing; } eb.WithDescription(list); eb.WithFooter($"`{prefix}buywaifu [name]` `{prefix}waifu [name]` | Resets in {23 - DateTime.Now.Hour} Hours {60 - DateTime.Now.Minute} Minutes"); eb.Color = BasicUtil.RandomColor(); return eb; }*/ public static EmbedBuilder NewShopEmbed(List<ShopWaifu> waifus, string prefix, ulong guildId = 0, ShopType type = ShopType.Waifu) { var client = Program.GetClient(); var eb = new EmbedBuilder(); if (type == ShopType.Gacha) eb.WithAuthor("Gacha Shop", client.CurrentUser.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-shop")); else if (type == ShopType.Mod) { eb.WithAuthor("Mod Shop", client.CurrentUser.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-shop")); eb.WithDescription($"A waifu shop controlled by server moderators.\n`{prefix}MsAddWaifu` | `{prefix}MsRemoveWaifu` - requires Namiko Pro Guild+."); } else { eb.WithAuthor("Waifu Shop", client.CurrentUser.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-shop")); if (guildId != 0) eb.WithDescription($"Open in [browser](https://namiko.moe/WaifuShop/{guildId})"); } string list = WaifuShopWaifuList(waifus); eb.AddField("\n:books: Commands", $"`{prefix}BuyWaifu [name]` | `{prefix}Waifu [search]` | `{prefix}Ws` | `{prefix}Gs` | `{prefix}Ms`", true); list = list.Any() ? list : "~ Shop Empty ~"; eb.AddField("<:MiaHug:536580304018735135> Waifus", list, false); //eb.WithThumbnailUrl(waifus[0].Waifu.ImageUrl); if (type != ShopType.Mod) eb.WithFooter($"Resets in {11 - DateTime.Now.Hour % 12} Hours {60 - DateTime.Now.Minute} Minutes"); eb.Color = BasicUtil.RandomColor(); return eb; }
private EmbedBuilder ModuleHelpEmbed(ModuleInfo moduleInfo) { if (moduleInfo == null) { return(null); } var eb = new EmbedBuilder(); eb.WithTitle(moduleInfo.Name); string desc = ""; foreach (var x in moduleInfo.Commands) { try { desc += $" **{x.Name}**\n{x.Summary}\n"; } catch { } } eb.WithColor(BasicUtil.RandomColor()); eb.WithDescription(desc); return(eb); }
public static EmbedBuilder RedditPostEmbed(Post post, string sub) { var eb = new EmbedBuilder() .WithColor(BasicUtil.RandomColor()) .WithAuthor(post.Title.ShortenString(200, 197), "https://i.imgur.com/GthCice.png", "https://www.reddit.com" + post.Permalink) .WithFooter("r/" + sub + " - " + post.UpVotes + " upvotes"); try { eb.WithDescription(((SelfPost)post).SelfText); } catch { } try { eb.WithImageUrl(((LinkPost)post).URL); } catch { } try { if (eb.Description == null && post.Comments.Top[0].UpVotes > 40) { eb.WithDescription(post.Comments.Top[0].Body); } } catch { } if (eb.Description == null && eb.ImageUrl == null) { return(null); } return(eb); }
public static EmbedBuilder GiveEmbed(IUser from, IUser to, int amount) { EmbedBuilder eb = new EmbedBuilder(); eb.AddField("Toasties <:toastie3:454441133876183060>", $"{from.Username} gave {to.Username} **{amount.ToString("n0")}** {ToastieUtil.RandomEmote()}!"); eb.WithColor(BasicUtil.RandomColor()); return(eb); }
public EmbedBuilderPrepared(IUser author = null) : base() { WithColor(BasicUtil.RandomColor()); if (author != null) { WithAuthor(author.Username + "#" + author.Discriminator, author.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-author")); } }
public EmbedBuilderLava(IUser author = null) : base() { WithColor(BasicUtil.RandomColor()); WithFooter($"Namiko 🌋 Lavalink"); string title = author != null ? $"{author.Username}#{author.Discriminator}" : "Player"; WithAuthor(title, author?.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-lavalink")); }
public async Task Decline([Remainder] string str = "") { //common variables IUser user = Context.User; EmbedBuilder eb = new EmbedBuilder(); eb.WithAuthor(user); eb.WithColor(ProfileDb.GetHex(out string colour, user.Id) ? (Discord.Color)UserUtil.HexToColor(colour) : BasicUtil.RandomColor()); var proposals = MarriageDb.GetProposalsReceived(user.Id, Context.Guild.Id); proposals.AddRange(MarriageDb.GetProposalsSent(user.Id, Context.Guild.Id)); var proposal = await UserUtil.SelectMarriage(proposals, this); if (proposal == null) { eb.WithDescription("~ You have no proposals ~"); await Context.Channel.SendMessageAsync($"", false, eb.Build()); return; } ulong wife = UserUtil.GetWifeId(proposal, user.Id); // Swagness //creating decline action var decline = new DialogueBoxOption { Action = async(IUserMessage message) => { await MarriageDb.DeleteMarriageOrProposal(proposal); //embed eb.WithAuthor(user); eb.WithDescription($"You declined the proposal.\nBetter luck next time **{ BasicUtil.IdToMention(wife) }**."); await message.ModifyAsync(x => x.Embed = eb.Build()); //execution condition }, After = OnExecute.RemoveReactions }; //creating cancel var cancel = new DialogueBoxOption { After = OnExecute.Delete }; //making dialog embed var dia = new DialogueBox(); dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), decline); dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel); dia.Timeout = new TimeSpan(0, 1, 0); dia.Embed = new EmbedBuilderPrepared(user) .WithDescription($"Are you sure you wish to Decline **{ BasicUtil.IdToMention(wife) }**?").Build(); // await DialogueReplyAsync(dia); }
public static EmbedBuilder NoBoxEmbed(IUser author) { var eb = new EmbedBuilder(); eb.WithAuthor(author); eb.WithColor(BasicUtil.RandomColor()); eb.WithDescription($"You have no lootboxes!\nVote for me on [Discord Bots]({LinkHelper.GetRedirectUrl(LinkHelper.Vote, "Vote", "cmd-lootbox")}) to get one!"); return(eb); }
public async Task SellWaifu([Remainder] string str = "") { var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id)), this); //waifus existance if (waifu == null) { return; } int worth = WaifuUtil.GetSalePrice(waifu.Tier); var sell = new DialogueBoxOption(); sell.Action = async(IUserMessage message) => { if (!UserInventoryDb.OwnsWaifu(Context.User.Id, waifu, Context.Guild.Id)) { await message.ModifyAsync(x => { x.Embed = new EmbedBuilderPrepared(Context.User).WithDescription("You tried :star:").Build(); }); return; } try { await BalanceDb.AddToasties(Context.User.Id, worth, Context.Guild.Id); } catch (Exception ex) { await Context.Channel.SendMessageAsync(ex.Message); } //removing waifu + confirmation await UserInventoryDb.DeleteWaifu(Context.User.Id, waifu, Context.Guild.Id); await message.ModifyAsync(x => { x.Content = $"You sold **{waifu.Name}** for **{worth.ToString("n0")}** toasties."; x.Embed = ToastieUtil.ToastieEmbed(Context.User, BalanceDb.GetToasties(Context.User.Id, Context.Guild.Id)).Build(); }); }; sell.After = OnExecute.RemoveReactions; var cancel = new DialogueBoxOption(); cancel.After = OnExecute.Delete; var dia = new DialogueBox(); dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), sell); dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel); dia.Timeout = new TimeSpan(0, 1, 0); dia.Embed = new EmbedBuilder() .WithAuthor(Context.User) .WithColor(BasicUtil.RandomColor()) .WithDescription($"Sell **{waifu.Name}** for **{worth.ToString("n0")}** toasties?").Build(); await DialogueReplyAsync(dia); return; }
public static EmbedBuilder BoxOpeningEmbed(IUser author) { var eb = new EmbedBuilder(); eb.WithAuthor(author); eb.WithColor(BasicUtil.RandomColor()); eb.WithTitle("Opening your lootbox!"); eb.WithImageUrl("https://data.whicdn.com/images/109950962/original.gif"); return(eb); }
public static EmbedBuilder ToEmbed(ReactionImage img) { EmbedBuilder embed = new EmbedBuilder(); string path = $"{AppSettings.ImageUrlPath + "reaction/"}{img.Name}{(img.GuildId > 0 ? "/" + img.GuildId.ToString() : "")}/{img.Id}.{img.ImageFileType}"; embed.WithImageUrl(path); embed.WithFooter($"{img.Name} id: {img.Id}"); embed.WithColor(BasicUtil.RandomColor()); return(embed); }
public async Task SendEmbed(string name, ulong id) { var eb = await JsonHelper.ReadJson <EmbedBuilder>(Assembly.GetEntryAssembly().Location.Replace(@"Namiko.dll", $@"embeds/{name}")); eb.WithColor(BasicUtil.RandomColor()); ISocketMessageChannel ch = Context.Client.GetChannel(id) as ISocketMessageChannel; await ch.SendMessageAsync(embed : eb.Build()); await Context.Channel.SendMessageAsync($"Saying in {ch.Name}", false, embed : eb.Build()); }
// REDDIT public static EmbedBuilder SubredditSubscribedEmbed(Subreddit sub, int upvotes) { var eb = new EmbedBuilder(); eb.WithAuthor(sub.Title, sub.CommunityIcon, "https://www.reddit.com" + sub.URL); try { eb.WithImageUrl(sub.BannerImg); } catch { } eb.WithDescription($"Subscribed to hot posts from **{sub.Name}** that reach **{upvotes}** or more upvotes."); eb.WithColor(BasicUtil.RandomColor()); eb.WithFooter($"Type `!unsub {sub.Name}` to unsubscribe."); return(eb); }
public async Task TestAnnouncement(string name, int days) { var eb = await JsonHelper.ReadJson <EmbedBuilder>(Assembly.GetEntryAssembly().Location.Replace(@"Namiko.dll", $@"embeds/{name}")); eb.WithColor(BasicUtil.RandomColor()); using var db = new NamikoDbContext(); var voters = db.Voters.AsQueryable().Where(x => x.Date > DateTime.Now.AddDays(-days)).Select(x => x.UserId).ToHashSet(); int votes = db.Voters.AsQueryable().Where(x => x.Date > DateTime.Now.AddDays(-days)).Count(); await ReplyAsync($"Sending this to {voters.Count} users. Votes - {votes}"); await ReplyAsync(embed : eb.Build()); }
public async Task Divorce([Remainder] string str = "") { //common variables IUser user = Context.User; EmbedBuilder eb = new EmbedBuilder(); Discord.Color userColour = ProfileDb.GetHex(out string colour, user.Id) ? (Discord.Color)UserUtil.HexToColor(colour) : BasicUtil.RandomColor(); eb.WithColor(userColour); eb.WithAuthor(user); var marriages = MarriageDb.GetMarriages(user.Id, Context.Guild.Id); var marriage = await UserUtil.SelectMarriage(marriages, this); if (marriage == null) { eb.WithDescription("~ You are not married ~"); await Context.Channel.SendMessageAsync($"", false, eb.Build()); return; } ulong wife = UserUtil.GetWifeId(marriage, user.Id); // //creating divorce action var divorce = new DialogueBoxOption { Action = async(IUserMessage message) => { await MarriageDb.DeleteMarriageOrProposal(marriage); await message.ModifyAsync((x) => x.Embed = eb.WithDescription($"You divorced **{ BasicUtil.IdToMention(wife) }**.\n*~ May you both find happiness elsewhere ~*").Build()); //execution condition }, After = OnExecute.RemoveReactions }; //creating cancel var cancel = new DialogueBoxOption { After = OnExecute.Delete }; //making dialog embed var dia = new DialogueBox(); dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), divorce); dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel); dia.Timeout = new TimeSpan(0, 1, 0); dia.Embed = new EmbedBuilderPrepared(user) .WithColor(userColour) .WithDescription($"Are you sure you wish to Divorce **{ BasicUtil.IdToMention(wife) }**?").Build(); // await DialogueReplyAsync(dia); }
public static EmbedBuilder SauceEmbed(Sauce sauce, string requestUrl) { var eb = new EmbedBuilder(); string desc = "**Results:**\n"; foreach (var x in sauce.Results) { desc += $"• {x.Similarity}% - [{x.DatabaseName}]({x.SourceURL ?? x.InnerSource})"; if (x.InnerSource != null && x.SourceURL != null) { if (IsValidUrl(x.InnerSource)) { desc += $" -> [{GetDomainFromUrl(x.InnerSource)}]({x.InnerSource})\n"; } else { desc += $" -> {x.InnerSource}\n"; } } if (!desc.EndsWith("\n")) { desc += "\n"; } if (x.ExtUrls != null) { x.ExtUrls.Remove(x.InnerSource); x.ExtUrls.Remove(x.SourceURL); if (x.ExtUrls.Count > 0) { desc += $"Extra: "; foreach (var url in x.ExtUrls) { if (IsValidUrl(url)) { desc += $"[{GetDomainFromUrl(url)}]({url}) "; } } desc += "\n"; } } } eb.WithDescription(desc); eb.WithThumbnailUrl(requestUrl); eb.WithAuthor("SauceNao", "http://www.userlogos.org/files/logos/zoinzberg/SauceNAO_2.png", "https://saucenao.com/"); eb.WithColor(BasicUtil.RandomColor()); 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 WeeklyGetEmbed(int amount, int current, IUser user, string prefix) { var eb = new EmbedBuilder(); eb.WithAuthor(user.ToString(), user.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-weekly")); eb.WithDescription($"You received **{amount.ToString("n0")}** {RandomEmote()}\nNow you have **{current.ToString("n0")}** {RandomEmote()}"); eb.WithColor(BasicUtil.RandomColor()); if (!(PremiumDb.IsPremium(user.Id, ProType.Pro) || PremiumDb.IsPremium(user.Id, ProType.ProPlus))) { eb.WithFooter($"Check out Pro upgrades! `{prefix}Pro`"); } return(eb); }
private async Task SendWaifuUpdatedMessage(Waifu waifu, string field, string oldVal, string newVal) { var author = Context.User; newVal = newVal == null || newVal == "" ? "-" : newVal.ShortenString(1000, 1000, " ..."); oldVal = oldVal == null || oldVal == "" ? "-" : oldVal.ShortenString(1000, 1000, " ..."); var eb = new EmbedBuilder() .WithAuthor($"{waifu.Name} - {field} updated", waifu.HostImageUrl) .AddField("New", newVal, true) .AddField("Old", oldVal, true) .WithColor(BasicUtil.RandomColor()) .WithFooter(author.Username + "#" + author.Discriminator, author.GetAvatarUrl()); await Context.Channel.SendMessageAsync(embed : eb.Build()); }
public async Task Banroulette() { var banroulette = BanrouletteDb.GetBanroulette(Context.Channel.Id); if (banroulette == null) { await Context.Channel.SendMessageAsync($"There is no running Ban Roulette in this channel. `{Program.GetPrefix(Context)}nbr` to start a new one."); return; } var users = BasicUtil.UserList(Context.Client, BanrouletteDb.GetParticipants(banroulette)); var role = Context.Guild.GetRole(banroulette.RoleReqId); string participants = users.Count > 0 ? $"\n\nParticipants:\n{BanrouletteUtil.BanrouletteParticipants(users)}" : ""; await Context.Channel.SendMessageAsync($"{BanrouletteUtil.BanrouletteDetails(banroulette, role, users.Count)}" + participants); }
public static EmbedBuilder DailyGetEmbed(IUser user, int streak, int amount, int balance, string prefix) { var eb = new EmbedBuilder(); eb.WithAuthor(user.ToString(), user.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-daily")); eb.WithDescription($"You're on a **{streak.ToString("n0")}** day streak. You receive **{amount.ToString("n0")}** {ToastieUtil.RandomEmote()}\n" + $"Now you have **{balance.ToString("n0")}** {ToastieUtil.RandomEmote()}\n\n" + $"Vote for me on [Discord Bots]({LinkHelper.GetRedirectUrl(LinkHelper.Vote, "Vote", "cmd-daily")}) every day to receive a lootbox!"); eb.WithColor(BasicUtil.RandomColor()); if (!(PremiumDb.IsPremium(user.Id, ProType.Pro) || PremiumDb.IsPremium(user.Id, ProType.ProPlus))) { eb.WithFooter($"Check out Pro upgrades! `{prefix}Pro`"); } return(eb); }
public async Task JoinBanroulette() { var banroulette = BanrouletteDb.GetBanroulette(Context.Channel.Id); if (banroulette == null) { await Context.Channel.SendMessageAsync(":x: There is no running Ban Roulette in this channel."); return; } if (banroulette.RoleReqId != 0) { var user = Context.User as SocketGuildUser; if (!user.Roles.Any(x => x.Id == banroulette.RoleReqId)) { await Context.Channel.SendMessageAsync(":x: You do not have the required role to join!"); return; } } var userIds = BanrouletteDb.GetParticipants(banroulette); if (userIds.Count >= banroulette.MaxParticipants - 1 && banroulette.MaxParticipants != 0) { await Context.Channel.SendMessageAsync("Ban Roulette is full!"); return; } bool joined = await BanrouletteDb.AddParticipant(Context.User.Id, banroulette); if (!joined) { await Context.Channel.SendMessageAsync("You are already participating! Eager to get smoked, aren't you?"); return; } var users = BasicUtil.UserList(Context.Client, userIds); users.Add(Context.User); string response = "You joined the Ban Roulette. *Heh.*" + (users.Count > 10 ? "" : "\n\nList of Participants:\n" + BanrouletteUtil.BanrouletteParticipants(users)); await Context.Channel.SendMessageAsync(response); }
public static EmbedBuilder TeamEmbed(SocketRole teamRole, SocketRole leaderRole) { var eb = new EmbedBuilder(); List <SocketGuildUser> leaderUsers = new List <SocketGuildUser>(leaderRole.Members); List <SocketGuildUser> teamUsers = new List <SocketGuildUser>(teamRole.Members); teamUsers.RemoveAll(x => leaderUsers.Any(y => y.Equals(x))); int totalToasties = 0; int totalWaifus = 0; int totalWaifuValue = 0; string memberList = ""; foreach (var x in teamUsers) { memberList += $"\n`{x.Username}`"; totalToasties += BalanceDb.GetToasties(x.Id, x.Guild.Id); var waifus = UserInventoryDb.GetWaifus(x.Id, x.Guild.Id); totalWaifus += waifus.Count; totalWaifuValue += WaifuUtil.WaifuValue(waifus); } string leaderList = ""; foreach (var x in leaderUsers) { leaderList += $"\n`{x.Username}`"; totalToasties += BalanceDb.GetToasties(x.Id, x.Guild.Id); var waifus = UserInventoryDb.GetWaifus(x.Id, x.Guild.Id); totalWaifus += waifus.Count; totalWaifuValue += WaifuUtil.WaifuValue(waifus); } eb.WithDescription($"Total Toasties: {totalToasties.ToString("n0")} <:toastie3:454441133876183060>\n" + $"Total Waifus: {totalWaifus.ToString("n0")} :two_hearts:\n" + $"Waifu Value: {totalWaifuValue.ToString("n0")} <:toastie3:454441133876183060>"); eb.AddField($":shield: Members - {teamUsers.Count}", memberList == "" ? "-" : memberList, true); eb.AddField($":crown: Leaders - {leaderUsers.Count}", leaderList == "" ? "-" : leaderList, true); eb.WithColor(BasicUtil.RandomColor()); eb.WithTitle(teamRole.Name); return(eb); }