mirror of
https://github.com/Jetsparrow/antiantiswearingbot.git
synced 2026-04-26 05:55:05 +03:00
Update to .net 10 and bump dependencies
This commit is contained in:
parent
253a05ae31
commit
377b615207
@ -18,7 +18,7 @@ public class DetectTests : BleepTestsBase
|
||||
[InlineData("еб*ть—колотить", "*ебать")]
|
||||
[InlineData("Получилась полная х**ня: даже не знаю, что и сказать, б**.", "*херня\n**бля")]
|
||||
[InlineData("Сергей опять вы**нулся своим знанием тонкостей русского языка; в окно еб*шил стылый ноябрьский ветер. ", "*выебнулся\n**ебашил")]
|
||||
public async void DetectWordsWithPunctuation(string text, string expected)
|
||||
public async Task DetectWordsWithPunctuation(string text, string expected)
|
||||
{
|
||||
var unbleep = (await ubl.UnbleepSwears(text)).Replace("\r\n", "\n").Trim();
|
||||
Assert.Equal(expected, unbleep);
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit.v3" Version="3.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
<UseAppHost>False</UseAppHost>
|
||||
</PropertyGroup>
|
||||
@ -11,25 +11,16 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Telegram.Bot" Version="19.0.0" />
|
||||
<PackageReference Include="Telegram.Bot" Version="22.9.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="secrets.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="aasb.cfg.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="aasb.cfg.secret.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="dict\ObsceneDictionaryRu.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@ -54,7 +54,7 @@ public class AntiAntiSwearingBot : IHostedService
|
||||
TelegramBot = new TelegramBotClient(TelegramSettings.ApiKey, httpClient);
|
||||
|
||||
Log.LogInformation("Connecting to Telegram...");
|
||||
Me = await TelegramBot.GetMeAsync();
|
||||
Me = await TelegramBot.GetMe(cancellationToken);
|
||||
Log.LogInformation("Connected to Telegram as @{Username}", Me.Username);
|
||||
Router = new ChatCommandRouter(Me.Username, AccessCfg);
|
||||
Router.Register(new LearnCommand(Dict), "learn");
|
||||
@ -74,7 +74,7 @@ public class AntiAntiSwearingBot : IHostedService
|
||||
|
||||
public async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await TelegramBot.CloseAsync();
|
||||
await TelegramBot.Close();
|
||||
}
|
||||
|
||||
Task HandleErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)
|
||||
@ -97,23 +97,26 @@ public class AntiAntiSwearingBot : IHostedService
|
||||
|
||||
if (cmdResponse != null)
|
||||
{
|
||||
await TelegramBot.SendTextMessageAsync(
|
||||
msg.Chat.Id,
|
||||
await TelegramBot.SendMessage(
|
||||
msg.Chat,
|
||||
cmdResponse,
|
||||
replyToMessageId: msg.MessageId,
|
||||
replyParameters: new ReplyParameters { MessageId = msg.MessageId },
|
||||
parseMode: ParseMode.MarkdownV2,
|
||||
disableNotification: true);
|
||||
disableNotification: true,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var unbleepResponse = await Unbleeper.UnbleepSwears(msg.Text);
|
||||
if (unbleepResponse != null)
|
||||
await TelegramBot.SendTextMessageAsync(
|
||||
msg.Chat.Id,
|
||||
await TelegramBot.SendMessage(
|
||||
msg.Chat,
|
||||
unbleepResponse,
|
||||
replyToMessageId: msg.MessageId,
|
||||
disableNotification: true);
|
||||
replyParameters: new ReplyParameters { MessageId = msg.MessageId },
|
||||
disableNotification: true,
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user