mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[store] kitties now have own http client factory
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Options;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Net.Http.Headers;
|
||||
using West.TelegramBot.ContentStore.API;
|
||||
using West.TelegramBot.ContentStore.Option;
|
||||
using West.TelegramBot.ContentStore.Service;
|
||||
|
||||
@@ -27,6 +29,17 @@ public class ContentStore : Module
|
||||
{
|
||||
services.AddOption<AllowNsfw>();
|
||||
|
||||
var kittiesConfig = Configuration.GetSection("KittiesService");
|
||||
services.AddHttpClient<IKittiesApi, KittiesApi>(c =>
|
||||
{
|
||||
c.BaseAddress = kittiesConfig.GetValue<Uri>("Uri");
|
||||
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
|
||||
"Bearer",
|
||||
kittiesConfig.GetValue<string>("token")
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
foreach (var serviceType in MediaServiceTypes)
|
||||
{
|
||||
services.AddScoped(typeof(IRandomMediaService), serviceType);
|
||||
|
||||
Reference in New Issue
Block a user