public async Task <StickerPackOutput> CreateStickerPackAsync(Admin currentAdmin, StickerPackInput input)
        {
            if (!await _tgBot.IsStickerPackExistsAsync(input.Name))
            {
                throw StickerPackException.StickerPackDoesNotExists(input.Name);
            }

            var stickerPack = currentAdmin.AddNewStickerPack(input.Name, input.Alias, await FindTagsAsync(input.TagIds));

            var stickers = await _tgBot.GetStickerFilesFromPackAsync(stickerPack.Name);

            var filePath = await _tgBot.GetFilePathAsync(stickerPack.Name, fileId : stickers.First());

            return(new StickerPackOutput(stickerPack, filePath, stickers.Count()));
        }
Example #2
0
 public async Task <StatusCodeResult> IsStickerPackExistsWithNameAsync([FromRoute] string name)
 {
     return(await _tgBot.IsStickerPackExistsAsync(name)
         ? new OkResult() as StatusCodeResult
         : new NotFoundResult());
 }