mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[store] Reduce amount of hardcoded values.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
@@ -7,6 +6,7 @@ namespace West.TelegramBot.ContentStore.Service;
|
||||
public class AnimBoobsService : IRandomMediaService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
public StoreItem StoreItem { get; } = new("boobs", "Сиськи движущиеся", 120);
|
||||
|
||||
public AnimBoobsService()
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace West.TelegramBot.ContentStore.Service;
|
||||
public abstract class AnimalAsAService : IRandomMediaService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
public abstract StoreItem StoreItem { get; }
|
||||
|
||||
protected AnimalAsAService(Uri baseAddress)
|
||||
{
|
||||
@@ -15,6 +16,7 @@ public abstract class AnimalAsAService : IRandomMediaService
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public async Task<RandomMedia> GetRandomMediaAsync()
|
||||
{
|
||||
var resp = await _httpClient.GetAsync("images/search");
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using Telegram.Bot.Types;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
|
||||
public class CatApiService : AnimalAsAService
|
||||
{
|
||||
public override StoreItem StoreItem { get; } = new("cat", "Котэ", 40);
|
||||
public CatApiService() : base(new Uri("https://api.thecatapi.com/v1/")) {}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
|
||||
public class DogApiService : AnimalAsAService
|
||||
{
|
||||
public override StoreItem StoreItem { get; } = new("dog", "Пёсель", 40);
|
||||
public DogApiService() : base(new Uri("https://api.thedogapi.com/v1/")) {}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
using Telegram.Bot.Types;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
|
||||
public interface IRandomMediaService
|
||||
{
|
||||
public StoreItem StoreItem { get; }
|
||||
|
||||
public Task<RandomMedia> GetRandomMediaAsync();
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using Telegram.Bot.Types;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
@@ -7,7 +6,8 @@ namespace West.TelegramBot.ContentStore.Service;
|
||||
public class OBoobsService : IRandomMediaService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
public StoreItem StoreItem { get; } = new("boobs", "Сиськи", 60);
|
||||
|
||||
public OBoobsService()
|
||||
{
|
||||
_httpClient = new HttpClient
|
||||
|
||||
Reference in New Issue
Block a user