From 9d8b5b06fb519b4f837b3b746ac3f841df3b61aa Mon Sep 17 00:00:00 2001 From: Kirill Poletaev Date: Thu, 11 Jan 2024 00:56:18 +0300 Subject: [PATCH] Fix logging (#2) --- src/VahterBanBot/Bot.fs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/VahterBanBot/Bot.fs b/src/VahterBanBot/Bot.fs index 4fbef47..e0f7e43 100644 --- a/src/VahterBanBot/Bot.fs +++ b/src/VahterBanBot/Bot.fs @@ -201,10 +201,11 @@ let aggregateUnbanResultInLogMsg message targetUserId targetUsername = let softBanResultInLogMsg (message: Message) (duration: int) = let logMsgBuilder = StringBuilder() - %logMsgBuilder.Append $"Vahter @{message.From.Username}({message.From.Id}) " - %logMsgBuilder.Append $"softbanned @{message.ReplyToMessage.From.Username}({message.ReplyToMessage.From.Id}) " - %logMsgBuilder.Append $"in @{message.Chat.Username}({message.Chat.Id}) " - %logMsgBuilder.Append $"until {DateTime.Now.AddHours duration}" + let untilDate = (DateTime.Now.AddHours duration).ToString "u" + %logMsgBuilder.Append $"Vahter {prependUsername message.From.Username}({message.From.Id}) " + %logMsgBuilder.Append $"softbanned {prependUsername message.ReplyToMessage.From.Username}({message.ReplyToMessage.From.Id}) " + %logMsgBuilder.Append $"in {prependUsername message.Chat.Username}({message.Chat.Id}) " + %logMsgBuilder.Append $"until {untilDate}" string logMsgBuilder