mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[store] Make store use AllowNSFW option
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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();
|
||||
|
||||
protected AbstractNsfwService(AllowNsfw allowNsfw)
|
||||
{
|
||||
_allowNsfw = allowNsfw;
|
||||
}
|
||||
|
||||
public async Task<bool> CanView(Chat chat, User user) => await _allowNsfw.GetValueAsync(chat.Id);
|
||||
}
|
||||
Reference in New Issue
Block a user