2022-11-14 00:49:56 +02:00
|
|
|
using Kruzya.TelegramBot.Core.Data;
|
|
|
|
|
using Kruzya.TelegramBot.Core.Extensions;
|
|
|
|
|
using Telegram.Bot.Types;
|
|
|
|
|
using Telegram.Bot.Types.Enums;
|
2022-02-16 17:07:30 +02:00
|
|
|
using West.TelegramBot.ContentStore.Model;
|
|
|
|
|
|
|
|
|
|
namespace West.TelegramBot.ContentStore.Service;
|
|
|
|
|
|
|
|
|
|
public class AnimBoobsService : IRandomMediaService
|
|
|
|
|
{
|
2022-11-14 00:49:56 +02:00
|
|
|
private readonly CoreContext _db;
|
2022-02-16 17:07:30 +02:00
|
|
|
private readonly HttpClient _httpClient;
|
2022-02-16 18:27:09 +02:00
|
|
|
public StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи движущиеся", 120, 40);
|
2022-02-16 17:07:30 +02:00
|
|
|
|
2022-11-14 00:49:56 +02:00
|
|
|
public AnimBoobsService(CoreContext db)
|
2022-02-16 17:07:30 +02:00
|
|
|
{
|
2022-11-14 00:49:56 +02:00
|
|
|
_db = db;
|
2022-02-16 17:07:30 +02:00
|
|
|
_httpClient = new HttpClient()
|
|
|
|
|
{
|
|
|
|
|
BaseAddress = new Uri("https://westdev.me/_boobs/")
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<RandomMedia> GetRandomMediaAsync()
|
|
|
|
|
{
|
|
|
|
|
var fileName = await _httpClient.GetStringAsync("index.php");
|
|
|
|
|
return new RandomMedia($"https://westdev.me/_boobs/media/{fileName}")
|
|
|
|
|
{
|
|
|
|
|
Type = InputMediaType.Video
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-11-14 00:49:56 +02:00
|
|
|
|
|
|
|
|
public async Task<bool> CanView(Chat chat, User user)
|
|
|
|
|
{
|
|
|
|
|
var option = await _db.UserValues.FindOrCreateOption(chat.Id, "AllowNSFW");
|
|
|
|
|
|
|
|
|
|
return option.GetValue(false);
|
|
|
|
|
}
|
2022-02-16 17:07:30 +02:00
|
|
|
}
|