mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[store] disable store command for bots, cleanup
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
using System.Reflection;
|
using Kruzya.TelegramBot.Core;
|
||||||
using Kruzya.TelegramBot.Core;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using West.TelegramBot.ContentStore.Service;
|
using West.TelegramBot.ContentStore.Service;
|
||||||
using Module = Kruzya.TelegramBot.Core.Module;
|
|
||||||
|
|
||||||
namespace West.TelegramBot.ContentStore;
|
namespace West.TelegramBot.ContentStore;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ using Telegram.Bot;
|
|||||||
using Telegram.Bot.Types.Enums;
|
using Telegram.Bot.Types.Enums;
|
||||||
using Telegram.Bot.Types.InputFiles;
|
using Telegram.Bot.Types.InputFiles;
|
||||||
using Telegram.Bot.Types.ReplyMarkups;
|
using Telegram.Bot.Types.ReplyMarkups;
|
||||||
using West.TelegramBot.ContentStore.Model;
|
|
||||||
using West.TelegramBot.ContentStore.Service;
|
using West.TelegramBot.ContentStore.Service;
|
||||||
|
|
||||||
namespace West.TelegramBot.ContentStore.Handler;
|
namespace West.TelegramBot.ContentStore.Handler;
|
||||||
@@ -31,6 +30,11 @@ public class Store : BotEventHandler
|
|||||||
[Command(InChat.Public, "store", CommandParseMode.Both)]
|
[Command(InChat.Public, "store", CommandParseMode.Both)]
|
||||||
public async Task HandleStore()
|
public async Task HandleStore()
|
||||||
{
|
{
|
||||||
|
if (From.IsBot)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_reputation == null)
|
if (_reputation == null)
|
||||||
{
|
{
|
||||||
await Bot.SendTextMessageAsync(Chat.Id, "Reputation is unavailable.");
|
await Bot.SendTextMessageAsync(Chat.Id, "Reputation is unavailable.");
|
||||||
@@ -85,7 +89,7 @@ public class Store : BotEventHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var storeItem = mediaService.StoreItem;
|
var storeItem = mediaService!.StoreItem;
|
||||||
var messageId = query.Message!.MessageId;
|
var messageId = query.Message!.MessageId;
|
||||||
var reputation = await _reputation.GetUserReputationAsync(Chat, From);
|
var reputation = await _reputation.GetUserReputationAsync(Chat, From);
|
||||||
if (reputation < storeItem.Price)
|
if (reputation < storeItem.Price)
|
||||||
|
|||||||
Reference in New Issue
Block a user