Skip to content

Instantly share code, notes, and snippets.

@davidcon
Created November 9, 2019 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidcon/5b4f0b3f927185332d86403ccce7e7d0 to your computer and use it in GitHub Desktop.
Save davidcon/5b4f0b3f927185332d86403ccce7e7d0 to your computer and use it in GitHub Desktop.
Send a Local File
using (FileStream fs = System.IO.File.OpenRead("c:\test.txt"))
{
Telegram.Bot.Types.InputFiles.InputOnlineFile inputOnlineFile = new Telegram.Bot
.Types.InputFiles.InputOnlineFile(fs, "FileName.txt");
await Bot.SendDocumentAsync(
chatId: new Telegram.Bot.Types.ChatId(1234),
document: inputOnlineFile,
caption: "User Manual",
parseMode: ParseMode.Markdown);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment