fix: build and lots of obsolete warnings

This commit is contained in:
Andriy
2025-02-09 17:40:03 +02:00
parent 8917a8ba5f
commit c3a553f68d
29 changed files with 103 additions and 108 deletions
+3 -6
View File
@@ -3,10 +3,9 @@ using BotFramework.Config;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;
using Telegram.Bot;
using Telegram.Bot.Types;
namespace Kruzya.TelegramBot.Core.Controllers
@@ -16,14 +15,12 @@ namespace Kruzya.TelegramBot.Core.Controllers
private const string SecretTokenHeader = "X-Telegram-Bot-Api-Secret-Token";
private readonly ILogger<Telegram> _logger;
private readonly ITelegramBotClient _client;
private readonly IUpdateTarget _updateTarget;
private readonly string _secretToken;
public Telegram(ILogger<Telegram> logger, ITelegramBotClient client, IUpdateTarget updateTarget, IOptions<BotConfig> config)
public Telegram(ILogger<Telegram> logger, IUpdateTarget updateTarget, IOptions<BotConfig> config)
{
_logger = logger;
_client = client;
_updateTarget = updateTarget;
_secretToken = config.Value.Webhook.SecretToken;
@@ -50,7 +47,7 @@ namespace Kruzya.TelegramBot.Core.Controllers
}
var body = await (new StreamReader(Request.Body)).ReadToEndAsync();
LaunchHandle(JsonConvert.DeserializeObject<Update>(body));
LaunchHandle(JsonSerializer.Deserialize<Update>(body));
return Ok();
}