update Telegram.Bot to 18.0.0

This commit is contained in:
xpnas 2022-11-01 21:56:28 +08:00
parent a373cac904
commit 42f9461643
4 changed files with 13 additions and 4 deletions

View File

@ -49,7 +49,9 @@ namespace Inotify.Controllers
sendTemplate.IsActive = sendAuthInfo.Active; sendTemplate.IsActive = sendAuthInfo.Active;
sendTemplate.AuthToTemplate(sendAuthInfo.AuthData); sendTemplate.AuthToTemplate(sendAuthInfo.AuthData);
userSendTemplates.Add(sendTemplate); userSendTemplates.Add(sendTemplate);
sendTemplate.Values.FirstOrDefault(e => e.Name == nameof(BarkSendTemplate.Auth.SendUrl)).Value = "";
var bark = sendTemplate.Values.FirstOrDefault(e => e.Name == nameof(BarkSendTemplate.Auth.SendUrl));
if(bark!=null) bark .Value = "";
} }
} }

View File

@ -27,7 +27,7 @@
<PackageReference Include="NPoco.Migrations" Version="0.3.2" /> <PackageReference Include="NPoco.Migrations" Version="0.3.2" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.10" /> <PackageReference Include="Portable.BouncyCastle" Version="1.8.10" />
<PackageReference Include="System.Runtime.Caching" Version="5.0.0" /> <PackageReference Include="System.Runtime.Caching" Version="5.0.0" />
<PackageReference Include="Telegram.Bot" Version="15.7.1" /> <PackageReference Include="Telegram.Bot" Version="18.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,6 @@
 
using System; using System;
using System.Net.Http;
using Telegram.Bot; using Telegram.Bot;
using Telegram.Bot.Types.InputFiles; using Telegram.Bot.Types.InputFiles;
@ -26,7 +27,13 @@ namespace Inotify.Sends.Products
{ {
var proxy = GetProxy(); var proxy = GetProxy();
var client = proxy == null ? new TelegramBotClient(Auth.BotToken) : new TelegramBotClient(Auth.BotToken, proxy); var proxyHttpClientHandler = new HttpClientHandler
{
Proxy = proxy,
UseProxy = true,
};
var httpClient = new HttpClient(proxyHttpClientHandler);
var client = proxy == null ? new TelegramBotClient(Auth.BotToken) : new TelegramBotClient(Auth.BotToken, httpClient);
var content = string.IsNullOrEmpty(message.Title) ? message.Title : message.Title + "\n" + message.Data; var content = string.IsNullOrEmpty(message.Title) ? message.Title : message.Title + "\n" + message.Data;
var isIMG = !string.IsNullOrEmpty(message.Title) && IsUrl(message.Title) && IsImage(message.Title) && string.IsNullOrEmpty(message.Data); var isIMG = !string.IsNullOrEmpty(message.Title) && IsUrl(message.Title) && IsImage(message.Title) && string.IsNullOrEmpty(message.Data);
if (isIMG) if (isIMG)

View File

@ -203,7 +203,7 @@ namespace Inotify.Sends
if (proxyurl != null) if (proxyurl != null)
{ {
WebProxy proxy = new WebProxy WebProxy proxy = new WebProxy()
{ {
Address = new Uri(proxyurl) Address = new Uri(proxyurl)
}; };