Files

31 lines
1.1 KiB
C#
Raw Permalink Normal View History

2023-07-21 18:40:24 +03:00
using Telegram.Bot.Types;
2022-11-14 00:49:56 +02:00
using Telegram.Bot.Types.Enums;
2022-02-16 17:07:30 +02:00
using West.TelegramBot.ContentStore.Model;
2023-07-21 18:40:24 +03:00
using West.TelegramBot.ContentStore.Option;
2022-02-16 17:07:30 +02:00
namespace West.TelegramBot.ContentStore.Service;
2023-07-21 18:40:24 +03:00
public class AnimBoobsService : AbstractNsfwService
2022-02-16 17:07:30 +02:00
{
private readonly HttpClient _httpClient;
public override StoreItem StoreItem { get; } = new("anim_boobs", "Сиськи.gif", 120, 40);
2022-02-16 17:07:30 +02:00
2023-07-28 23:14:36 +03:00
public AnimBoobsService(AllowNsfw allowNsfw, IHttpClientFactory factory) : base(allowNsfw)
2022-02-16 17:07:30 +02:00
{
2023-07-28 23:14:36 +03:00
_httpClient = factory.CreateClient();
_httpClient.BaseAddress = new Uri("https://westdev.me/_boobs/");
2022-02-16 17:07:30 +02:00
}
public override async Task<RandomMedia> GetRandomMediaAsync(Chat chat, User user)
2022-02-16 17:07:30 +02:00
{
var fileName = await _httpClient.GetStringAsync("index.php");
2023-01-02 23:31:05 +02:00
// https://bugs.telegram.org/c/23674 workaround
var video = await _httpClient.GetStreamAsync($"https://westdev.me/_boobs/media/{fileName}");
2025-02-09 17:40:03 +02:00
return new RandomMedia(new InputFileStream(video, fileName))
2022-02-16 17:07:30 +02:00
{
2023-01-02 23:31:05 +02:00
Type = InputMediaType.Video,
Nsfw = true
2022-02-16 17:07:30 +02:00
};
}
}