From d90556d44518b59f63e483ead83a2f8ae81be056 Mon Sep 17 00:00:00 2001 From: West14 <30056636+West14@users.noreply.github.com> Date: Tue, 26 Apr 2022 00:49:32 +0300 Subject: [PATCH] [store] add reputation info to bot answers --- modules/ContentStore/Handler/Store.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/ContentStore/Handler/Store.cs b/modules/ContentStore/Handler/Store.cs index bfbc8a1..9b65e90 100644 --- a/modules/ContentStore/Handler/Store.cs +++ b/modules/ContentStore/Handler/Store.cs @@ -87,21 +87,22 @@ public class Store : BotEventHandler var storeItem = mediaService.StoreItem; var messageId = query.Message!.MessageId; - if (await _reputation.GetUserReputationAsync(Chat, From) < storeItem.Price) + var reputation = await _reputation.GetUserReputationAsync(Chat, From); + if (reputation < storeItem.Price) { await Bot.EditMessageTextAsync( Chat.Id, messageId, - $"{From.ToHtml()}, продолжай работать и тебе обязательно хватит на покупку.", + $"{From.ToHtml()} ({reputation}), продолжай работать и тебе обязательно хватит на покупку.", ParseMode.Html); await AnswerQuery(query.Id); return; } - await _reputation.IncrementReputationAsync(Chat, From, -storeItem.Price); + reputation = await _reputation.SetUserReputationAsync(Chat, From, reputation - storeItem.Price); await Bot.EditMessageTextAsync(Chat.Id, messageId, - $"{From.ToHtml()} купил \"{storeItem.Name}\".", + $"{From.ToHtml()} ({reputation}) купил \"{storeItem.Name}\".", ParseMode.Html); var randomMedia = await mediaService!.GetRandomMediaAsync();