public async Task Favs() { // Get all species fav'd by this user. List <string> lines = new List <string>(); using (SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM Species WHERE id IN (SELECT species_id FROM Favorites WHERE user_id = $user_id);")) { cmd.Parameters.AddWithValue("$user_id", Context.User.Id); foreach (DataRow row in await Db.GetRowsAsync(cmd)) { ISpecies sp = await Db.CreateSpeciesFromDataRowAsync(row); long fav_count = 0; // Get the number of times this species has been favorited. using (SQLiteCommand cmd2 = new SQLiteCommand("SELECT COUNT(*) FROM Favorites WHERE species_id = $species_id;")) { cmd2.Parameters.AddWithValue("$species_id", sp.Id); fav_count = await Db.GetScalarAsync <long>(cmd2); } lines.Add(sp.GetShortName() + (fav_count > 1 ? string.Format(" (+{0})", fav_count) : "")); } lines.Sort(); } // Display the species list. if (lines.Count() <= 0) { await BotUtils.ReplyAsync_Info(Context, string.Format("**{0}** has not favorited any species.", Context.User.Username)); } else { IPaginatedMessage message = new PaginatedMessage(); message.AddLines(lines); message.SetTitle($"⭐ Species favorited by {Context.User.Username} ({lines.Count()})"); message.SetThumbnailUrl(Context.User.GetAvatarUrl(size: 32)); message.AddPageNumbers(); await ReplyAsync(message); } }