diff --git a/.github/dev.yml b/.github/dev.yml index 3b5849b..27a4134 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.2.1-dev.$(Rev:r) +name: 3.2.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index d8ca67d..c65c13a 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -10,7 +10,7 @@ namespace WTelegramClientTest static class Program_DownloadSavedMedia { // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number - static async Task Main(string[] args) + static async Task Main(string[] _) { Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -30,8 +30,8 @@ namespace WTelegramClientTest if (message.media is MessageMediaDocument { document: Document document }) { - int slash = document.mime_type.IndexOf('/'); // quick & dirty conversion from MIME type to file extension - var filename = slash > 0 ? $"{document.id}.{document.mime_type[(slash + 1)..]}" : $"{document.id}.bin"; + var filename = document.Filename; // use document original filename, or build a name from document ID & MIME type: + filename ??= $"{document.id}.{document.mime_type[(document.mime_type.IndexOf('/') + 1)..]}"; Console.WriteLine("Downloading " + filename); using var fileStream = File.Create(filename); await client.DownloadFileAsync(document, fileStream); diff --git a/FAQ.md b/FAQ.md index 2363f45..1c1d382 100644 --- a/FAQ.md +++ b/FAQ.md @@ -299,6 +299,7 @@ Also, remember to add a `using TL;` at the top of your files to have access to a # Troubleshooting guide Here is a list of common issues and how to fix them so that your program work correctly: + 1) Are you using the Nuget package or the library source code? It is not recommended to copy/compile the source code of the library for a normal usage. When built in DEBUG mode, the source code connects to Telegram test servers (see also [FAQ #6](#wrong-server)).