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:
@@ -1,27 +1,24 @@
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
using West.TelegramBot.ContentStore.Option;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
|
||||
public class AnimBoobsService : IRandomMediaService
|
||||
public class AnimBoobsService : AbstractNsfwService
|
||||
{
|
||||
private readonly CoreContext _db;
|
||||
private readonly HttpClient _httpClient;
|
||||
public StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи движущиеся", 120, 40);
|
||||
public override StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи движущиеся", 120, 40);
|
||||
|
||||
public AnimBoobsService(CoreContext db)
|
||||
public AnimBoobsService(AllowNsfw allowNsfw) : base(allowNsfw)
|
||||
{
|
||||
_db = db;
|
||||
_httpClient = new HttpClient()
|
||||
_httpClient = new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri("https://westdev.me/_boobs/")
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<RandomMedia> GetRandomMediaAsync()
|
||||
public override async Task<RandomMedia> GetRandomMediaAsync()
|
||||
{
|
||||
var fileName = await _httpClient.GetStringAsync("index.php");
|
||||
// https://bugs.telegram.org/c/23674 workaround
|
||||
@@ -33,11 +30,4 @@ public class AnimBoobsService : IRandomMediaService
|
||||
Nsfw = true
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<bool> CanView(Chat chat, User user)
|
||||
{
|
||||
var option = await _db.UserValues.FindOrCreateOption(chat.Id, "AllowNSFW");
|
||||
|
||||
return option.GetValue(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user