TelegramBots / Telegram.Bot

.NET Client for Telegram Bot API
https://telegrambots.github.io/book
MIT License
3.22k stars 690 forks source link

SendDocumentAsync with InputOnlineFile is not working #1131

Closed ahmetbasdan closed 2 years ago

ahmetbasdan commented 2 years ago

it does not send the pdf file I have selected to telegram

image

karb0f0s commented 2 years ago

Please follow issue template If you want to chat, feel free to join our group.

4rsa commented 1 year ago

Did you find the solution, because once I updated Telegram.Bot to (19.0.0.0) version I could not use this code anymore.

AykutCanturk commented 1 year ago

me too... as if there's no InputOnlineFile a method. I'm stuck. the only way for me to return back older version of telegram.bot.

4rsa commented 1 year ago

Now I just use the following commands: async static Task SendVideo(ITelegramBotClient BotClient, Update update, CancellationToken arg3, Message message, string filename) { try { using (var videoStream = System.IO.File.OpenRead(@"D:\VideosAPI\Video")) { await BotClient.SendVideoAsync( chatId: message.Chat.Id, video: new InputFileStream(videoStream, "video.mp4"), // Use InputFileStream for local files supportsStreaming: true, cancellationToken: arg3 ); } Console.WriteLine("Video sent successfully!"); } catch (Exception ex) { Console.WriteLine($"Failed to send the video: {ex.Message}"); } }. Bbecause I keep video on my computer.

Azizjan-leo commented 1 month ago

So guys there is an abstract class. I used it's InputFile.FromStream(stream, "Points.xlsx") method. All work fine 👯