public async Task SendRandomName([Remainder] string input) { //Removes spaces before and after commas string whitespaceRemovedInput = Regex.Replace(input, " *, *", ","); //Separates names into individual strings and stores in array string[] names = whitespaceRemovedInput.Split(','); double percentageChance = 100 / names.Length; Random rnd = new Random(); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User));; fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Random Name"); eb.AddField("Result", $"{names[rnd.Next(0, names.Length - 1)]} ({Math.Round(percentageChance, 2)}% chance)"); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); }
public async Task SendRandomName([Remainder] string input) { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } //Removes spaces before and after commas string whitespaceRemovedInput = Regex.Replace(input, " *, *", ","); //Separates names into individual strings and stores in array string[] names = whitespaceRemovedInput.Split(','); double percentageChance = 100 / names.Length; Random rnd = new Random(); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Random Name"); eb.AddField("Result", $"{names[rnd.Next(0, names.Length - 1)]} ({Math.Round(percentageChance, 2)}% chance)"); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("randomname", Context); }
public async Task SendPremium() { string bulletPoint = "<:small_blue_diamond:759438353057316866>"; EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Premium"); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); eb.WithUrl("https://donatebot.io/checkout/701178110485463152"); eb.WithThumbnailUrl("https://i.imgur.com/VA6V7Dn.png"); eb.WithDescription("Consider [buying Premium](https://donatebot.io/checkout/701178110485463152) to support the development of the bot and gain access to some cool Premium benefits. Every penny spent goes straight back into keeping the bot up and running, and helps fund the development costs of new features. Thank you for your kindness. [Click here](https://donatebot.io/checkout/701178110485463152) to purchase a tier!"); eb.AddField("High Quality Tier", $"This tier grants you access to the following benefits:\n{bulletPoint} Random Message Embed Colour\n{bulletPoint} A Spot on the r!thanks List\n{bulletPoint} Premium Embed Footer\n{bulletPoint} Stats Leaderboard"); eb.AddField("Wooden Tier", $"This tier grants you access to the following benefits:\n{bulletPoint} Random Message Embed Colour\n{bulletPoint} A Spot on the r!thanks List\n{bulletPoint} Premium Embed Footer\n{bulletPoint} Stats Leaderboard"); eb.AddField("Cloth Tier", $"This tier grants you access to the following benefits:\n{bulletPoint} Random Message Embed Colour\n{bulletPoint} A Spot on the r!thanks List\n{bulletPoint} Premium Embed Footer"); fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User)); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); }
public async Task SendGangInfo([Remainder] string gang) { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } LeaderboardUtils.GangInfo gInfo = await LeaderboardUtils.GetGangInfo(HttpUtility.UrlEncode(gang)); Console.WriteLine(gInfo.gangOwner); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"{gInfo.gangName}"); eb.AddField("Owner", $"{gInfo.gangOwner}"); eb.AddField("Member Count", $"{gInfo.memberCount}"); eb.AddField("Cash", $"{gInfo.gangCash}"); eb.AddField("Loot", $"{gInfo.gangLoot}"); if (gInfo.gangIcon.Contains("imgur")) { eb.WithThumbnailUrl(gInfo.gangIcon); } eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("ganginfo", Context); }
public async Task SendITemStore() { Stopwatch sw = new Stopwatch(); sw.Start(); List <ItemStoreItem> itemStore = await Utilities.GetItemStore(); if (itemStore == null) { await ReplyAsync("The item store is yet to refresh. Please wait a while and try again."); } EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); eb.WithTitle($"Item Store"); eb.WithFooter(fb); foreach (var item in itemStore) { eb.AddField($"{item.ItemName}", $"Price: {Regex.Replace(item.ItemPrice, @"\t|\n|\r", "")}\nLink: [{item.ItemName}]({item.ItemURL})"); } sw.Stop(); fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User, sw));; await ReplyAsync("", false, eb.Build()); }
public void CreateFooterEmbed(string color, string title = null, string description = null, string thumbnailurl = null, string footer_text = null, string footer_thumbnail = null) { SetEmbedColor(color); if (title != null && title != "none") { embed.WithTitle(title); } if (description != null && description != "none") { embed.WithDescription(description); } if (thumbnailurl != null && thumbnailurl != "none") { embed.WithThumbnailUrl(thumbnailurl); } footer = new EmbedFooterBuilder(); if (footer_text != null && footer_text != "none") { embed.WithFooter(footer .WithText(footer_text) ); } if (footer_thumbnail != null && footer_thumbnail != "none") { embed.WithFooter(footer .WithIconUrl(footer_thumbnail) ); } }
public void MakeEmbed(string color = "white", string title = null, string description = null, string imageUrl = null, string footerDescription = null, string footerImageUrl = null) { EmbedColor(color); if (title != null) { basic.WithTitle(title); } if (description != null) { basic.WithDescription(description); } if (imageUrl != null) { basic.WithThumbnailUrl(imageUrl); } footer = new EmbedFooterBuilder(); if (footerDescription != null) { basic.WithFooter(footer .WithText(footerDescription) ); } if (footerImageUrl != null) { basic.WithFooter(footer .WithIconUrl(footerImageUrl) ); } }
public async Task SendCommandHelpMessage(string cmdName) { Stopwatch sw = new Stopwatch(); sw.Start(); cmdName = cmdName.Replace("r!", "").ToLower(); List <CommandInfo> commands = Program._commands.Commands.ToList(); CommandInfo command = commands.FirstOrDefault(x => x.Name == cmdName.ToLower()); StringBuilder args = new StringBuilder(); foreach (ParameterInfo arg in command.Parameters) { args.Append($" [{arg.Name}]"); } EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"{Program.prefix}{command.Name}"); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); eb.WithDescription($"{command.Summary}"); eb.AddField($"Usage", $"{Program.prefix}{command.Name} {args.ToString()}"); eb.WithFooter(Utilities.GetFooter(Context.User, sw)); await ReplyAsync("", false, eb.Build()); }
public static Embed GetEmbedMessage(string messageTitle, string fieldTitle, string fieldContents, SocketUser user, EmbedFooterBuilder fb = null) { EmbedBuilder eb = new EmbedBuilder(); if (user != null) { if (fb == null && user != null) { fb = new EmbedFooterBuilder(); fb.WithText(PremiumUtils.SelectFooterEmbedText(user));; fb.WithIconUrl(user.GetAvatarUrl()); } eb.WithTitle($"{messageTitle}"); eb.AddField($"{fieldTitle}", $"{fieldContents}"); eb.WithColor(PremiumUtils.SelectEmbedColour(user)); eb.WithFooter(fb); return(eb.Build()); } else { eb.WithTitle($"{messageTitle}"); eb.AddField($"{fieldTitle}", $"{fieldContents}"); eb.WithColor(Color.Red); eb.WithFooter(fb); return(eb.Build()); } }
public async Task AddServerAd(string search, int timeSpan = 1) { //timeSpan is in hours if (!GuildUtils.GetSettings(Context.Guild.Id).ServerSearch) { await ReplyAsync("", false, Utilities.GetEmbedMessage("Rust Servers", "Error", Language.ServerInfo_Disabled, Context.User)); return; } var server = await Utilities.GetServer(search); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Search"); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); eb.WithFooter(fb); eb.AddField("Rust Servers", Language.ServerInfo_AddedAd); Utilities.adServers.Add(search, DateTime.Now.AddHours(timeSpan)); await ReplyAsync("", false, eb.Build()); }
public async Task SendTemplates(string input) { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } Utilities.ForumTemplate t = await Utilities.GetTemplate(input); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"{t.name} Template"); eb.AddField("BB Code", $"```{t.bbcode}```"); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("total", Context); }
public async Task SendItemInfo([Remainder] string item) { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } SSRPItems.Item i = await SSRPItems.GetItem(item); if (i == null) { await Context.Channel.SendMessageAsync("Item not found. Try using the item's exact name, eg: m9k_psg1"); await Utilities.StatusMessage("item", Context); } else { EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"{i.itemName}"); eb.AddField("Description", $"{i.itemDesc}"); eb.AddField("Weight", $"{i.weight}"); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("item", Context); } }
public async Task SendGuildList() { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } StringBuilder sb = new StringBuilder(); foreach (var guild in Program._client.Guilds) { sb.Append($"{guild.Name} | {guild.Id}\n"); } EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Guild List"); eb.AddField($"{Program._client.Guilds.Count}", sb.ToString()); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("roll", Context); }
public async Task Tri([Remainder] SocketGuildUser user = null) { user ??= (SocketGuildUser)Context.User; var account = EntityConverter.ConvertUser(user); var embed = new EmbedBuilder(); embed.WithColor(Colors.Get(account.Element.ToString())); var author = new EmbedAuthorBuilder(); author.WithName(user.DisplayName()); author.WithIconUrl(user.GetAvatarUrl()); embed.WithAuthor(author); embed.WithThumbnailUrl(user.GetAvatarUrl()); embed.AddField("Server Stats", JsonConvert.SerializeObject(account.ServerStats, Formatting.Indented).Replace("{", "").Replace("}", "").Replace("\"", "")); embed.AddField("Battle Stats", JsonConvert.SerializeObject(account.BattleStats, Formatting.Indented).Replace("{", "").Replace("}", "").Replace("\"", "")); embed.AddField("Account Created:", user.CreatedAt); embed.AddField("Unlocked Classes", account.BonusClasses.Count == 0 ? "none" : string.Join(", ", account.BonusClasses)); var Footer = new EmbedFooterBuilder(); Footer.WithText("Joined this Server on " + user.JoinedAt.Value.Date.ToString("dd-MM-yyyy")); Footer.WithIconUrl(Sprites.GetImageFromName("Iodem")); embed.WithFooter(Footer); await Context.Channel.SendMessageAsync("", false, embed.Build()); Console.WriteLine(JsonConvert.SerializeObject(account, Formatting.Indented)); }
public async Task <Embed> GetCurrent(string query) { EmbedBuilder builder = new EmbedBuilder(); WeatherUndergroundResponse wuresponse = await GetWeatherUndergroundConditionsResponse(query); if (wuresponse != null && wuresponse.current_observation != null) { var co = wuresponse.current_observation; builder.WithThumbnailUrl(co.icon_url); builder.WithTitle($"{wuresponse.current_observation.display_location.city}, {wuresponse.current_observation.display_location.state_name}"); builder.AddField("Current Temperature", $"{wuresponse.current_observation.temp_f}"); builder.AddField("Humidity", $"{wuresponse.current_observation.relative_humidity}"); builder.AddField("Wind", $"{wuresponse.current_observation.wind_string}"); builder.AddField("Forecast", $"{wuresponse.current_observation.forecast_url}"); EmbedFooterBuilder test = new EmbedFooterBuilder(); test.WithIconUrl("https://icons.wxug.com/logos/PNG/wundergroundLogo_4c.png"); test.WithText($"WeatherUnderground"); builder.WithFooter(test); builder.WithColor(Color.DarkGrey); } else { builder.Title = $"No result for search \"{query}\""; } return(builder.Build()); }
public async Task SendBlueprint([Remainder] string blueprint) { Stopwatch sw = new Stopwatch(); sw.Start(); StringBuilder sb = new StringBuilder(); Blueprint bp = BlueprintUtils.GetBlueprint(blueprint); if (bp == null) { await ReplyAsync($"Blueprint `{blueprint}` not found."); return; } sb.Append($"Research Cost: {bp.Cost}\n"); sb.Append($"Workbench Level: {bp.Workbench}\n"); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); eb.WithTitle("Blueprint"); eb.AddField($"{bp.Name}", $"{sb}"); eb.WithThumbnailUrl(bp.Icon); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User, sw));; fb.WithIconUrl(Context.User.GetAvatarUrl()); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); }
public async Task SendGuildList(string guildId) { StringBuilder sb = new StringBuilder(); SocketGuild g = Program._client.Guilds.FirstOrDefault(x => x.Id.ToString() == guildId); if (g == null) { throw new Exception("Specified guild not found."); } EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); int totalBots = await TotalBotsAsync(g); fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User));; fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Guild Information"); eb.AddField($"{g.Name}", $"**Guild Owner:** {g.Owner.Nickname}\n" + $"**Total Members:** {g.MemberCount}\n" + $"**Bots:** {totalBots}\n" + $"**Users:** {g.MemberCount - totalBots}\n" + $"**Text Channels:** {g.TextChannels.Count}\n" + $"**Voice Channels:** {g.VoiceChannels.Count}\n" + $"**Server Region:** {g.VoiceRegionId}\n" + $"**Created At:** {g.CreatedAt}\n"); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); }
public static Embed BuildEmbed(string sBranch, double iDays, string sVersion) { //Build the embed EmbedBuilder MyEmbedBuilder = new EmbedBuilder(); MyEmbedBuilder.WithColor(new Color(43, 234, 152)); MyEmbedBuilder.WithTitle("New DCS Update released!"); MyEmbedBuilder.WithDescription("[DCS Update Page](http://updates.digitalcombatsimulator.com)"); MyEmbedBuilder.WithThumbnailUrl("http://is1.mzstatic.com/image/thumb/Purple49/v4/71/b8/bc/71b8bca9-dfc5-e040-4e0f-54488d6a913b/source/175x175bb.jpg"); EmbedFooterBuilder MyFooterBuilder = new EmbedFooterBuilder(); MyFooterBuilder.WithText("Days since last update: " + iDays); MyFooterBuilder.WithIconUrl("https://cdn4.iconfinder.com/data/icons/small-n-flat/24/calendar-512.png"); MyEmbedBuilder.WithFooter(MyFooterBuilder); EmbedFieldBuilder MyEmbedField = new EmbedFieldBuilder(); MyEmbedField.WithIsInline(true); MyEmbedField.WithName("New " + sBranch + " release!"); MyEmbedField.WithValue("Version: " + sVersion); MyEmbedBuilder.AddField(MyEmbedField); return(MyEmbedBuilder); }
public async Task Help() { List <CommandInfo> commands = commandService.Commands.ToList(); EmbedBuilder embed = new EmbedBuilder(); embed.WithTitle("available commands"); embed.WithThumbnailUrl(Context.Client.CurrentUser.GetAvatarUrl()); string embedDescription = ""; foreach (CommandInfo command in commands) { if (command.Name == "help") { continue; } string commandDescription = ""; commandDescription += $"\n**{command.Name}**"; if (command.Parameters != null && command.Parameters.Count > 0) { commandDescription += $" [{command.Parameters[0].Name}]"; } commandDescription += "\n"; commandDescription += $"{command.Summary}\n"; embedDescription += commandDescription; } embed.WithDescription(embedDescription); EmbedFooterBuilder footer = new EmbedFooterBuilder(); footer.WithIconUrl(Context.Client.CurrentUser.GetAvatarUrl()); footer.WithText("github.com/lukeludlow/DestinyEmissary"); embed.WithFooter(footer); await Context.Channel.SendMessageAsync(embed : embed.Build()); }
public Embed GetOrderEmbed() { var builder = new EmbedBuilder(); builder.WithTitle($"{Server}"); builder.AddField("Order", OrderId, false); builder.AddField("Gold", Amount, false); builder.AddField("Buyer", Buyer, false); builder.WithThumbnailUrl("https://cdn.discordapp.com/attachments/739498423958372362/757573166347321405/Logo.jpg"); if (Performer != null) { var footer = new EmbedFooterBuilder(); footer.WithIconUrl(Performer.AvatarUrl) .WithText(Performer.Name); builder.AddField("___", "Order delivery by:"); builder.WithFooter(footer); builder.Color = Color.Green; } else { builder.Color = Color.Blue; } return(builder.Build()); }
public async Task Tri(SocketGuildUser user = null) { user = user ?? (SocketGuildUser)Context.User; var account = UserAccounts.GetAccount(user); var embed = new EmbedBuilder(); var p = new PlayerFighter(user); embed.WithColor(Colors.Get(account.Element.ToString())); var author = new EmbedAuthorBuilder(); author.WithName(user.DisplayName()); author.WithIconUrl(user.GetAvatarUrl()); embed.WithAuthor(author); embed.WithThumbnailUrl(user.GetAvatarUrl()); embed.AddField("Server Stats", JsonConvert.SerializeObject(account.ServerStats, Formatting.Indented)); embed.AddField("Battle Stats", JsonConvert.SerializeObject(account.BattleStats, Formatting.Indented)); embed.AddField("Unlocked Classes", account.BonusClasses.Length == 0 ? "none" : string.Join(", ", account.BonusClasses)); var Footer = new EmbedFooterBuilder(); Footer.WithText("Joined this Server on " + user.JoinedAt.Value.Date.ToString("dd-MM-yyyy")); Footer.WithIconUrl(Sprites.GetImageFromName("Iodem")); embed.WithFooter(Footer); //await Context.User.SendMessageAsync("", false, embed.Build()); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task SendCalc([Remainder] string math) { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } math = math.Replace("x", "*").Replace(",", ""); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"{new DataTable().Compute(math, null).ToString()}"); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("roll", Context); }
public async Task SendLeaderboards(string board, string category = null, string player = null) { if (PermissionManager.GetPerms(Context.Message.Author.Id) < PermissionConfig.User) { await Context.Channel.SendMessageAsync("Not authorised to run this command."); return; } var msg = await ReplyAsync("Obtaining data"); try { List <LeaderboardUtils.BoardInfo> bList = LeaderboardUtils.GetList(await LeaderboardUtils.GetBoard(board, player, category), player); string bName = board; foreach (LeaderboardUtils.Boards b in LeaderboardUtils.boards) { foreach (string alias in b.aliases) { if (alias == board) { bName = b.name; } } } EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"{bName}"); eb.WithColor(Color.Blue); eb.WithFooter(fb); foreach (LeaderboardUtils.BoardInfo b in bList) { eb.AddField($"{b.position}. {b.name}", $"{b.stat}"); } await ReplyAsync("", false, eb.Build()); await msg.DeleteAsync(); await Utilities.StatusMessage("leaderboards", Context); } catch (Exception e) { Console.WriteLine(e.Message); await ReplyAsync("Either this board doesn't exist or this player doesn't meet the requirements."); await msg.DeleteAsync(); await Utilities.StatusMessage("leaderboards", Context); return; } }
public async static Task <EmbedFooterBuilder> AddFooter(ICommandContext context) { IGuildUser user = await context.Guild.GetUserAsync((ulong)401452008957280257); embf.WithIconUrl(user.GetAvatarUrl()); embf.Text = $"Made by {user.Nickname??user.Username}"; return(embf); }
public static EmbedFooterBuilder GetFooter(SocketUser user, Stopwatch sw) { EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText(PremiumUtils.SelectFooterEmbedText(user, sw)); fb.WithIconUrl(user.GetAvatarUrl()); return(fb); }
public async Task Say10() { if (119019602574442497 != Context.User.Id) { // Secrurity check await ReplyAsync("This is a debug command, you cannot use it!"); return; } EmbedBuilder MyEmbedBuilder = new EmbedBuilder(); MyEmbedBuilder.WithColor(new Color(43, 234, 152)); MyEmbedBuilder.WithTitle("Your title"); MyEmbedBuilder.WithUrl("http://www.google.com"); //MyEmbedBuilder.WithDescription("My description"); MyEmbedBuilder.WithDescription("[Google](http://www.google.com)"); MyEmbedBuilder.WithThumbnailUrl("https://forum.codingwithstorm.com/Themes/Modern/images/vertex_image/social_twitter_icon.png"); MyEmbedBuilder.WithImageUrl("https://forum.codingwithstorm.com/Themes/Modern/images/vertex_image/social_facebook_icon.png"); //Footer EmbedFooterBuilder MyFooterBuilder = new EmbedFooterBuilder(); MyFooterBuilder.WithText("Your text"); MyFooterBuilder.WithIconUrl("https://forum.codingwithstorm.com/Smileys/Koloboks/wink3.gif"); MyEmbedBuilder.WithFooter(MyFooterBuilder); //Author EmbedAuthorBuilder MyAuthorBuilder = new EmbedAuthorBuilder(); MyAuthorBuilder.WithName("Your Name"); MyAuthorBuilder.WithUrl("http://www.google.com"); MyEmbedBuilder.WithAuthor(MyAuthorBuilder); //EmbedField EmbedFieldBuilder MyEmbedField = new EmbedFieldBuilder(); MyEmbedField.WithIsInline(true); MyEmbedField.WithName("Your Field Name"); MyEmbedField.WithValue("Your value"); MyEmbedField.WithValue("[Youtube](http://www.youtube.com)"); MyEmbedBuilder.AddField(MyEmbedField); MyEmbedBuilder.AddField(MyEmbedField); MyEmbedBuilder.AddField(MyEmbedField); MyEmbedBuilder.AddField(MyEmbedField); MyEmbedBuilder.AddField(MyEmbedField); MyEmbedBuilder.AddField(MyEmbedField); MyEmbedBuilder.AddField(MyEmbedField); await ReplyAsync("Swaaaag:", false, MyEmbedBuilder); }
public async static Task DisplayQuote(Quote q, IGuildUser[] users, ICommandContext context) { EmbedBuilder ebm = new EmbedBuilder() { Color = Color.Blue }; IGuildUser quotee = users[0]; ebm.WithTitle($"Quote #{q.Id} by {(quotee == null ? q.Qoutee.Username : (quotee.Nickname??quotee.Username))}"); if (quotee != null) { ebm.WithThumbnailUrl(quotee.GetAvatarUrl()); } if (ebm.ThumbnailUrl == null) { ebm.WithThumbnailUrl("https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png"); } ebm.AddField("Quote", $"```\r\n{q.QuoteText.RemoveAbuseCharacters()}\r\n```"); EmbedFooterBuilder efb = new EmbedFooterBuilder(); IGuildUser creator = users[1]; if (creator != null) { efb.WithIconUrl(creator.GetAvatarUrl()); } if (efb.IconUrl == null) { efb.WithIconUrl("https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png"); } efb.WithText($"Quoted by {(creator == null ? q.Creator.Username : (creator.Nickname??creator.Username))} on {q.Time.ToShortDateString()}"); ebm.WithFooter(efb); await context.Channel.SendMessageAsync(embed : ebm.Build()); }
public async Task GetServers() { if (!GuildUtils.GetSettings(Context.Guild.Id).ServerSearch) { await ReplyAsync("", false, Utilities.GetEmbedMessage("Rust Servers", "Error", Language.ServerInfo_Disabled, Context.User)); return; } var s = await Utilities.GetServers(); EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Top 5 Servers"); eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User)); eb.WithFooter(fb); foreach (var ad in Utilities.adServers) { if (ad.Value < DateTime.Now) { Utilities.adServers.Remove(ad.Key); } } foreach (var server in s) { eb.AddField($"{server.ServerName}", $"```css\nIP/Port: {server.IP}:{server.Port}\nPlayers: {server.CurrentPlayers}/{server.MaxPlayers}\nMap: {server.Map}\nMap Size: {server.MapSize}\nLast Wipe: {server.LastWipe}\nRank: {server.Rank}```"); } if (Utilities.adServers.Count == 0) { //If there are no ads eb.AddField("Ad Spot", $"This is an Ad spot for server owners to promote their servers to over {Statistics.GetTotalUsers()} users. For information on how to display your server here, contact Bunny#9220."); } else { //If there are ads available Random rnd = new Random(); rnd.Next(0, Utilities.adServers.Count); var serverIp = RandomValues(Utilities.adServers).First(); var server = await Utilities.GetServer(serverIp); eb.AddField($"Ad - {server.ServerName}", $"```css\nIP/Port: {server.IP}:{server.Port}\nPlayers: {server.CurrentPlayers}/{server.MaxPlayers}\nMap: {server.Map}\nMap Size: {server.MapSize}\nLast Wipe: {server.LastWipe}\nRank: {server.Rank}```"); } await ReplyAsync("", false, eb.Build()); }
public async Task SendGuildList(string guildID, bool genInvite) { StringBuilder sb = new StringBuilder(); string gName = ""; foreach (var guild in Program._client.Guilds) { try { if (guild.Id.ToString() == guildID) { //Gets first channel in the server and generates an invite link INestedChannel chnl = (INestedChannel)guild.TextChannels.First(); var invite = await chnl.CreateInviteAsync(); gName = guild.Name; //Appends invite link to message sb.Append("" + invite.Url); } } catch (Exception) { await ReplyAsync("No links found"); return; } } EmbedBuilder eb = new EmbedBuilder(); EmbedFooterBuilder fb = new EmbedFooterBuilder(); fb.WithText($"Called by {Context.Message.Author.Username}"); fb.WithIconUrl(Context.Message.Author.GetAvatarUrl()); eb.WithTitle($"Invite"); eb.AddField($"{gName}", sb.ToString()); eb.WithColor(Color.Blue); eb.WithFooter(fb); await ReplyAsync("", false, eb.Build()); await Utilities.StatusMessage("roll", Context); }
public static EmbedFooterBuilder SetFooter(String icon = null, String text = null) { EmbedFooterBuilder footer = new EmbedFooterBuilder(); if (Exists(icon)) { try { footer.WithIconUrl(icon); } catch (Exception) { } } ; if (Exists(text)) { footer.WithText(text); } return(footer); }