public async Task TagGetAllCommandAsync(string extra = null) { var tags = await DatabaseTags.GetAllTagsFromDatabase(Context); if (tags.Any()) { EmbedBuilder embedBuilder = new EmbedBuilder(); StringBuilder tagsGlobalColumnbuilder = new StringBuilder(); StringBuilder tagsLocalColumnbuilder = new StringBuilder(); var iGlobal = 0; var iLocal = 0; foreach (var tag in tags) { if (tag.Global) { tagsGlobalColumnbuilder.AppendLine(tag.Name); } if (tag.Global == false) { tagsLocalColumnbuilder.AppendLine(tag.Name); } } embedBuilder.AddField("Global tags", tagsGlobalColumnbuilder.ToString(), true); embedBuilder.AddField("Local tags", tagsLocalColumnbuilder.ToString(), true); await ReplyAsync(null, false, embedBuilder.Build()); } else { await ReplyAsync("No tags found for this server."); } }
public async Task TagGetAllCommandAsync(string extra = null) { var tags = await DatabaseTags.GetAllTagsFromDatabase(Context); tags = tags.OrderBy(x => x.Name).ToList(); if (tags.Any()) { EmbedBuilder embedBuilder = new EmbedBuilder(); StringBuilder tagsGlobalColumnbuilder = new StringBuilder(); StringBuilder tagsLocalColumnbuilder = new StringBuilder(); foreach (var tag in tags) { if (tag.Global) // global { tagsGlobalColumnbuilder.AppendLine(tag.Name); } if (tag.Global == false) // local { tagsLocalColumnbuilder.AppendLine(tag.Name); } } // if a builder has nothing in it (no tags), fill it with something if (tagsGlobalColumnbuilder.Length == 0) { tagsGlobalColumnbuilder.AppendLine("No global tags :c"); } if (tagsLocalColumnbuilder.Length == 0) { tagsLocalColumnbuilder.AppendLine("No local tags :c"); } embedBuilder.AddField("Global tags", tagsGlobalColumnbuilder.ToString(), true); embedBuilder.AddField("Local tags", tagsLocalColumnbuilder.ToString(), true); await ReplyAsync(null, false, embedBuilder.Build()); } else { await ReplyAsync("No tags found for this server."); } }