From d916342f1cc4d8a88e9f1f0dc46c897e03705148 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Oct 2022 19:54:12 +0200 Subject: [PATCH] Program_SecretChats timerstamp name for saved media --- .github/dev.yml | 2 +- Examples/Program_SecretChats.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index adf45c2..04417b8 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.0.1-dev.$(Rev:r) +name: 3.0.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 14412f3..c204af8 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -92,7 +92,7 @@ Type a command, or a message to send to the active secret chat:"); if (msg.Media != null && unem.message is EncryptedMessage { file: EncryptedFile ef }) { int slash = msg.Media.MimeType?.IndexOf('/') ?? 0; // quick & dirty conversion from MIME type to file extension - var filename = slash > 0 ? $"media.{msg.Media.MimeType[(slash + 1)..]}" : "media.bin"; + var filename = $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.{(slash > 0 ? msg.Media.MimeType[(slash + 1)..] : "bin")}"; Console.WriteLine($"{unem.message.ChatId}> {msg.Message} [attached file downloaded to {filename}]"); using var output = File.Create(filename); await Secrets.DownloadFile(ef, msg.Media, output);