public IChatEmbed MakeResponseEmbed(PokemonRaidPost post, IBotServerConfiguration guildConfig, string header) { var embed = new DiscordChatEmbed(); embed.WithDescription(header); embed.WithColor(post.Color[0], post.Color[1], post.Color[2]); embed.WithUrl(string.Format(Language.Formats["pokemonInfoLink"], post.PokemonId)); embed.WithThumbnailUrl(string.Format(Language.Formats["imageUrlLargePokemon"], post.PokemonId.ToString().PadLeft(3, '0'))); foreach (var message in post.Responses.OrderBy(x => x.MessageDate).Skip(Math.Max(0, post.Responses.Count() - 10)))//max fields is 25 { embed.AddField(string.Format(Language.Formats["responseInfo"], message.MessageDate.AddHours(TimeOffset), message.ChannelName, message.Username), message.Content); } //var builder = new EmbedBuilder(); /* * builder.WithColor(post.Color[0], post.Color[1], post.Color[2]); * * builder.WithDescription(header); * builder.WithUrl(string.Format(Language.Formats["pokemonInfoLink"], post.PokemonId)); * * builder.WithThumbnailUrl(string.Format(Language.Formats["imageUrlLargePokemon"], post.PokemonId.ToString().PadLeft(3, '0'))); * * foreach (var message in post.Responses.OrderBy(x => x.MessageDate).Skip(Math.Max(0, post.Responses.Count() - 10)))//max fields is 25 * { * builder.AddField(string.Format(Language.Formats["responseInfo"], message.MessageDate.AddHours(TimeOffset), message.ChannelName, message.Username), message.Content); * } */ return(embed); }
public IChatEmbed MakeHeaderEmbed(PokemonRaidPost post, string text = null) { if (string.IsNullOrEmpty(text)) { text = MakePostHeader(post); } var headerembed = new DiscordChatEmbed(); headerembed.WithColor(post.Color[0], post.Color[1], post.Color[2]); headerembed.WithUrl(string.Format(Language.Formats["pokemonInfoLink"], post.PokemonId)); headerembed.WithDescription(Language.RegularExpressions["discordChannel"].Replace(text, "").Replace(" in ", " ").Replace(" ", " ")); headerembed.WithThumbnailUrl(string.Format(Language.Formats["imageUrlSmallPokemon"], post.PokemonId.ToString().PadLeft(3, '0'))); return(headerembed); }