public async Task ViewContentCreators(CommandMessage message) { // Load streamers List <ContentCreator> streamers = await ContentCreatorDatabase.LoadAll(new Dictionary <string, object> { { "DiscordGuildId", message.Guild.Id } }); EmbedBuilder embed = new EmbedBuilder() .WithTitle("Content Creators"); // Add thumbnail embed.AddThumbnail(message.Guild.IconUrl); if (streamers == null || streamers.Count == 0) { // TODO: Add YT when implemented string prefix = CommandsService.GetPrefix(message.Guild.Id); embed.Description = $"No streamers found!\nUsers can add themselves with {prefix}ICreatorTwitch or {prefix}ICreatorYoutube command"; } else { StringBuilder desc = new StringBuilder(); foreach (ContentCreator streamer in streamers) { desc.Append($"{FC.Utils.DiscordMarkdownUtils.BulletPoint} {streamer.GuildNickName} | "); if (streamer.Twitch != null) { desc.Append($"Twitch: {streamer.Twitch.Link}"); } if (streamer.Youtube != null) { if (streamer.Twitch != null) { desc.Append(" | "); } desc.Append($"Youtube: {streamer.Youtube.Link}"); } desc.AppendLine(); } embed.Description = desc.ToString(); } // Send Embed await message.Channel.SendMessageAsync(embed : embed.Build(), messageReference : message.MessageReference); }
private Embed GetEmbed(string title, string description, string?iconUrl = null) { EmbedBuilder builder = new EmbedBuilder { Title = title, Description = description, }; if (!string.IsNullOrWhiteSpace(iconUrl)) { builder.AddThumbnail(iconUrl); } return(builder.Build()); }