[store] disable store command for bots, cleanup

This commit is contained in:
West14
2022-05-10 19:11:01 +03:00
parent 0aea2fac42
commit 2bffddd57c
2 changed files with 7 additions and 5 deletions
+6 -2
View File
@@ -10,7 +10,6 @@ using Telegram.Bot;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.InputFiles;
using Telegram.Bot.Types.ReplyMarkups;
using West.TelegramBot.ContentStore.Model;
using West.TelegramBot.ContentStore.Service;
namespace West.TelegramBot.ContentStore.Handler;
@@ -31,6 +30,11 @@ public class Store : BotEventHandler
[Command(InChat.Public, "store", CommandParseMode.Both)]
public async Task HandleStore()
{
if (From.IsBot)
{
return;
}
if (_reputation == null)
{
await Bot.SendTextMessageAsync(Chat.Id, "Reputation is unavailable.");
@@ -85,7 +89,7 @@ public class Store : BotEventHandler
return;
}
var storeItem = mediaService.StoreItem;
var storeItem = mediaService!.StoreItem;
var messageId = query.Message!.MessageId;
var reputation = await _reputation.GetUserReputationAsync(Chat, From);
if (reputation < storeItem.Price)