public async Task MinusPic(string genusName, string speciesName, int pictureIndex) { // Decrease the picture index by 1 (since users are expected to use the indices as shown by the "gallery" command, which begin at 1). --pictureIndex; if (await BotUtils.ReplyHasPrivilegeAsync(Context, PrivilegeLevel.ServerModerator)) { // Get the species. Species species = await BotUtils.ReplyFindSpeciesAsync(Context, genusName, speciesName); if (species is null) { return; } Picture[] pictures = await SpeciesUtils.GetPicturesAsync(species); Picture picture = (pictureIndex >= 0 && pictureIndex < pictures.Count()) ? pictures[pictureIndex] : null; // If the image was removed from anywhere (gallery or default species picture), this is set to "true". bool success = await SpeciesUtils.RemovePictureAsync(species, picture); if (success) { await BotUtils.ReplyAsync_Success(Context, string.Format("Successfully removed [picture]({1}) from **{0}**.", species.ShortName, picture.url)); } else { await BotUtils.ReplyAsync_Warning(Context, string.Format("**{0}** has no picture at this index.", species.ShortName)); } } }