public async Task EchoAsync(Update update) { var inputMsg = update.Message; var message = string.Empty; if (update.Type == UpdateType.Message) { var lineId = Regex.Match(inputMsg.Text, @"\d+").Value; var downloadUrl = string.Format(_config.LineStickerConfig.NormalStickerUrl, lineId); List <Telegram.Bot.Types.File> files = new List <Telegram.Bot.Types.File> (); using (var hc = new HttpClient()) { Stream imgsZip = null; try { imgsZip = await hc.GetStreamAsync(downloadUrl); } catch (Exception ex) { _logger.Log(LogLevel.Error, $"{ex}"); return; } using (ZipArchive zipFile = new ZipArchive(imgsZip)) { foreach (var entry in zipFile.Entries) { if (Regex.Match(entry.Name, @"^\[email protected]").Success) { using (Image image = Image.Load(entry.Open())) using (MemoryStream ms = new MemoryStream()) { image.Mutate(m => m.Resize(512, 512)); image.SaveAsPng(ms); ms.Seek(0, SeekOrigin.Begin); try { var file = await _botService.UploadStickerFileAsync( userId : (int)inputMsg.Chat.Id, pngSticker : new Telegram.Bot.Types.InputFiles.InputFileStream(ms) ); files.Add(file); } catch (Exception ex) { _logger.Log(LogLevel.Error, $"{ex}"); return; } } } } ; } } string tempName = $"bot{Guid.NewGuid ().ToString ("N")}_by_{_config.BotConfig.BotName}"; int firstEmojiUnicode = 0x1F601; var emojiString = char.ConvertFromUtf32(firstEmojiUnicode); var stickerTitle = "TransferBy@MartinBot"; await _botService.CreateNewStickerSetAsync( userId : (int)inputMsg.Chat.Id, name : tempName, title : stickerTitle, pngSticker : files[0].FileId, emojis : emojiString ); for (int i = 0; i < files.Count; i++) { emojiString = char.ConvertFromUtf32(firstEmojiUnicode + i); await _botService.AddStickerToSetAsync( userId : (int)inputMsg.Chat.Id, name : tempName, pngSticker : files[i].FileId, emojis : emojiString ); } var stickerSet = await _botService.GetStickerSetAsync( name : tempName ); var sticker = stickerSet.Stickers[0]; await _botService.SendStickerAsync( chatId : new ChatId(inputMsg.Chat.Id), sticker : new Telegram.Bot.Types.InputFiles.InputOnlineFile(sticker.FileId) ); } else { await _botService.SendTextMessageAsync( chatId : inputMsg.Chat.Id, text : $" Please, Send me a line sticker link " ); } }