mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[store] add nsfw guard for boobs
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
using Telegram.Bot.Types.Enums;
|
using Kruzya.TelegramBot.Core.Data;
|
||||||
|
using Kruzya.TelegramBot.Core.Extensions;
|
||||||
|
using Telegram.Bot.Types;
|
||||||
|
using Telegram.Bot.Types.Enums;
|
||||||
using West.TelegramBot.ContentStore.Model;
|
using West.TelegramBot.ContentStore.Model;
|
||||||
|
|
||||||
namespace West.TelegramBot.ContentStore.Service;
|
namespace West.TelegramBot.ContentStore.Service;
|
||||||
|
|
||||||
public class AnimBoobsService : IRandomMediaService
|
public class AnimBoobsService : IRandomMediaService
|
||||||
{
|
{
|
||||||
|
private readonly CoreContext _db;
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
public StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи движущиеся", 120, 40);
|
public StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи движущиеся", 120, 40);
|
||||||
|
|
||||||
public AnimBoobsService()
|
public AnimBoobsService(CoreContext db)
|
||||||
{
|
{
|
||||||
|
_db = db;
|
||||||
_httpClient = new HttpClient()
|
_httpClient = new HttpClient()
|
||||||
{
|
{
|
||||||
BaseAddress = new Uri("https://westdev.me/_boobs/")
|
BaseAddress = new Uri("https://westdev.me/_boobs/")
|
||||||
@@ -24,4 +29,11 @@ public class AnimBoobsService : IRandomMediaService
|
|||||||
Type = InputMediaType.Video
|
Type = InputMediaType.Video
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> CanView(Chat chat, User user)
|
||||||
|
{
|
||||||
|
var option = await _db.UserValues.FindOrCreateOption(chat.Id, "AllowNSFW");
|
||||||
|
|
||||||
|
return option.GetValue(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,20 @@
|
|||||||
using Newtonsoft.Json;
|
using Kruzya.TelegramBot.Core.Data;
|
||||||
|
using Kruzya.TelegramBot.Core.Extensions;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Telegram.Bot.Types;
|
||||||
using West.TelegramBot.ContentStore.Model;
|
using West.TelegramBot.ContentStore.Model;
|
||||||
|
|
||||||
namespace West.TelegramBot.ContentStore.Service;
|
namespace West.TelegramBot.ContentStore.Service;
|
||||||
|
|
||||||
public class OBoobsService : IRandomMediaService
|
public class OBoobsService : IRandomMediaService
|
||||||
{
|
{
|
||||||
|
private readonly CoreContext _db;
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
public StoreItem StoreItem { get; } = new("boobs", "Сиськи", 60, 30);
|
public StoreItem StoreItem { get; } = new("boobs", "Сиськи", 60, 30);
|
||||||
|
|
||||||
public OBoobsService()
|
public OBoobsService(CoreContext db)
|
||||||
{
|
{
|
||||||
|
_db = db;
|
||||||
_httpClient = new HttpClient
|
_httpClient = new HttpClient
|
||||||
{
|
{
|
||||||
BaseAddress = new Uri("http://api.oboobs.ru")
|
BaseAddress = new Uri("http://api.oboobs.ru")
|
||||||
@@ -26,4 +31,11 @@ public class OBoobsService : IRandomMediaService
|
|||||||
|
|
||||||
return new RandomMedia($"https://media.oboobs.ru/boobs/{boobsId}.jpg", boobsItem.Model);
|
return new RandomMedia($"https://media.oboobs.ru/boobs/{boobsId}.jpg", boobsItem.Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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