Files
telegram-bot/modules/ContentStore/Service/AbstractNsfwService.cs
T

20 lines
619 B
C#
Raw Normal View History

2023-07-21 18:40:24 +03:00
using Telegram.Bot.Types;
using West.TelegramBot.ContentStore.Model;
using West.TelegramBot.ContentStore.Option;
namespace West.TelegramBot.ContentStore.Service;
public abstract class AbstractNsfwService : IRandomMediaService
{
private readonly AllowNsfw _allowNsfw;
public abstract StoreItem StoreItem { get; }
public abstract Task<RandomMedia> GetRandomMediaAsync(Chat chat, User user);
2023-07-21 18:40:24 +03:00
protected AbstractNsfwService(AllowNsfw allowNsfw)
{
_allowNsfw = allowNsfw;
}
public async Task<bool> CanView(Chat chat, User user)
=> await _allowNsfw.GetValueAsync(chat.Id);
2023-07-21 18:40:24 +03:00
}