Esempio n. 1
0
        public async Task <int> LoadStickerSet(string stickerSetName)
        {
            var telegramStickerSet = await _telegramService.GetStickerSetAsync(stickerSetName);

            var stickerSet = CreateStickerSet(telegramStickerSet.Title, telegramStickerSet.Name);

            foreach (var sticker in telegramStickerSet.Stickers)
            {
                var memoryStream = new MemoryStream();
                await _telegramService.DownloadSticker(sticker.FileId, memoryStream);

                memoryStream.Position = 0;
                var uri = await _azureImageService.UploadImage($"{sticker.FileId}.webp", memoryStream);

                CreateSticker(sticker.Emoji, sticker.FileId, null,
                              stickerSet.Id, azureImageUrl: uri.AbsoluteUri);
            }

            return(stickerSet.Id);
        }