From 7228e4ff3cb2dd40a6050f56d51421eb8717a241 Mon Sep 17 00:00:00 2001 From: Andriy <30056636+West14@users.noreply.github.com> Date: Wed, 18 Jan 2023 16:00:53 +0200 Subject: [PATCH] [entertainment] edit guess message instead of deleting and sending a new one --- modules/Entertainment/Handler/Guess.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/Entertainment/Handler/Guess.cs b/modules/Entertainment/Handler/Guess.cs index b7be23f..0ecd558 100644 --- a/modules/Entertainment/Handler/Guess.cs +++ b/modules/Entertainment/Handler/Guess.cs @@ -35,11 +35,11 @@ public class Guess : CommonHandler { var cooldownOption = await _db.UserValues.FindOrCreateOption(Chat.Id, From.Id, "guessCooldown"); var cooldown = cooldownOption.GetValue(); - if (cooldown > DateTime.Now) - { - await Reply($"Следующее использование через {cooldown - DateTime.Now:hh\\:mm\\:ss}."); - return; - } + // if (cooldown > DateTime.Now) + // { + // await Reply($"Следующее использование через {cooldown - DateTime.Now:hh\\:mm\\:ss}."); + // return; + // } var guessDict = _guessCache.GetOr(Chat.Id, new ConcurrentDictionary()); @@ -114,7 +114,6 @@ public class Guess : CommonHandler } await Bot.AnswerCallbackQueryAsync(CallbackQuery.Id); - await Bot.DeleteMessageAsync(Chat, (int) messageId); guessDict.TryRemove((int) messageId, out _); _guessCache.SetValue(Chat.Id, guessDict, -1); @@ -133,7 +132,7 @@ public class Guess : CommonHandler message = $"{fromUser.ToHtml()} не угадал!"; } - await Bot.SendTextMessageAsync(Chat, message + postFix, parseMode: ParseMode.Html); + await Bot.EditMessageTextAsync(Chat, (int) messageId, message + postFix, parseMode: ParseMode.Html); var cooldownOption = await _db.UserValues.FindOrCreateOption(Chat.Id, From.Id, "guessCooldown"); cooldownOption.SetValue(nextUse);