Program_SecretChats timerstamp name for saved media

This commit is contained in:
Wizou 2022-10-21 19:54:12 +02:00
parent b9587e3997
commit d916342f1c
2 changed files with 2 additions and 2 deletions

2
.github/dev.yml vendored
View file

@ -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

View file

@ -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);