mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[core] add support of new bot api
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using Telegram.Bot.Types;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.Service;
|
||||
@@ -20,7 +21,7 @@ public abstract class AnimalAsAService : IRandomMediaService
|
||||
public async Task<RandomMedia> GetRandomMediaAsync()
|
||||
{
|
||||
var resp = await _httpClient.GetAsync("images/search");
|
||||
var catImage = JsonConvert.DeserializeObject<List<AnimalImage>>(await resp.Content.ReadAsStringAsync())[0];
|
||||
return new RandomMedia(catImage.Url);
|
||||
var catImage = JsonConvert.DeserializeObject<List<AnimalImage>>(await resp.Content.ReadAsStringAsync())![0];
|
||||
return new RandomMedia(new InputFileUrl(catImage.Url));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user