mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
25 lines
739 B
C#
25 lines
739 B
C#
using Telegram.Bot.Types;
|
|
using West.TelegramBot.ContentStore.API;
|
|
using West.TelegramBot.ContentStore.Model;
|
|
|
|
namespace West.TelegramBot.ContentStore.Service.SomeRandomApi;
|
|
|
|
public abstract class SomeRandomApiAbstractService : IRandomMediaService
|
|
{
|
|
private readonly ISomeRandomApi _api;
|
|
|
|
public StoreItem StoreItem { get; }
|
|
|
|
protected SomeRandomApiAbstractService(ISomeRandomApi api, string id, string name, double price, int order)
|
|
{
|
|
StoreItem = new(id, name, price, order);
|
|
_api = api;
|
|
}
|
|
|
|
public async Task<RandomMedia> GetRandomMediaAsync()
|
|
{
|
|
var image = await _api.GetAnimalAsync(StoreItem.Id);
|
|
|
|
return new RandomMedia(new InputFileUrl(image.Image), image.Fact);
|
|
}
|
|
} |