Skip to content
Merged

V2 #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project ToolsVersion="15.0">
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="9.0.8" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.8" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="9.0.8" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.8" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageVersion Include="System.Threading.RateLimiting" Version="9.0.8" />
<PackageVersion Include="Telegram.Bot" Version="22.6.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.4" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="9.0.8" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.8" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="9.0.8" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.8" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageVersion Include="System.Threading.RateLimiting" Version="9.0.8" />
<PackageVersion Include="Telegram.Bot" Version="22.6.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.3.15</Version>
<Version>2.0.0</Version>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>telegram,tg,commands</PackageTags>
Expand Down
11 changes: 2 additions & 9 deletions TgBotFrame.Commands.Help/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions TgBotFrame.Commands.Help/Properties/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,9 @@
<value>This category contains help commands. Most of these commands can be used without entering them manually, using the menu buttons from the help command</value>
</data>
<data name="HelpCommandController_HelpSyntax_Title" xml:space="preserve">
<value>Bot commands accept two types of values: commands and arguments\.
A command is an identifier of a specific action that the bot should perform\. Command identifiers are case\-insensitive: you can use both lowercase and uppercase letters\.
Parameters are the data required to perform an action\.
<value>Bot commands accept two types of values: commands and arguments\. A command is an identifier of a specific action that the bot should perform\. Command identifiers are case\-insensitive: you can use both lowercase and uppercase letters\. Parameters are the data required to perform an action\.

Any command begins with the `/` symbol; immediately after the symbol comes the
command identifier\.
Parameters are separated from each other and the command identifier by spaces\.
For example: the bot will respond to the message `/HelpCommand Help` with help on the `Help` command\.
Any command begins with the `/` symbol; immediately after the symbol comes the command identifier\. Parameters are separated from each other and the command identifier by spaces\. For example: the bot will respond to the message `/HelpCommand Help` with help on the `Help` command\.

Argument formats:

Expand Down
11 changes: 2 additions & 9 deletions TgBotFrame.Commands.Help/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,9 @@
<value>(без категории)</value>
</data>
<data name="HelpCommandController_HelpSyntax_Title" xml:space="preserve">
<value>Команды бота принимают два типа значений: команды и параметры\.
Команда является идентификатором конкретного действия, которое должен
совершить бот\. Идентификаторы команд не зависят от регистра: возможно
использовать как строчные, так и заглавные буквы\.
Параметрами являются данные необходимые для совершения действия\.
<value>Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\.

Любая команда начинается с символа `/`; сразу после символа идет идентификатор
команды\.
Параметры разделяются между собой и идентификатором команды пробелами\.
Например: на сообщение `/HelpCommand Help` бот ответит справкой по команде `Help`\.
Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. Например: на сообщение `/HelpCommand Help` бот ответит справкой по команде `Help`\.

Форматы аргументов:

Expand Down
2 changes: 1 addition & 1 deletion TgBotFrame.Commands.Help/TgBotFrame.Commands.Help.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.4.17</Version>
<Version>2.0.0</Version>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>telegram,tg,commands</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.2.10</Version>
<Version>2.0.0</Version>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>telegram,tg,commands</PackageTags>
Expand All @@ -31,14 +31,14 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Threading.RateLimiting" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TgBotFrame.Commands\TgBotFrame.Commands.csproj" />
<ProjectReference Include="..\TgBotFrame.Commands\TgBotFrame.Commands.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion TgBotFrame.Commands.Start/TgBotFrame.Commands.Start.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.2.11</Version>
<Version>2.0.0</Version>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>telegram,tg,commands</PackageTags>
Expand Down
2 changes: 1 addition & 1 deletion TgBotFrame.Commands/TgBotFrame.Commands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.3.11</Version>
<Version>2.0.0</Version>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>telegram,tg,commands</PackageTags>
Expand Down
9 changes: 3 additions & 6 deletions TgBotFrame.Tests/PipelineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public async Task IncPipeline()
{
IServiceCollection services = new ServiceCollection();
services.AddSingleton<IncrementMiddleware>();
services.AddSingleton<FrameMiddleware, IncrementMiddleware>(
x => x.GetRequiredService<IncrementMiddleware>());
services.AddSingleton<FrameMiddleware, IncrementMiddleware>(x => x.GetRequiredService<IncrementMiddleware>());
services.AddSingleton<ITelegramBotClient, StubTelegramBotClient>();
services.AddLogging(builder => builder.AddConsole());
services.AddMetrics();
Expand All @@ -55,11 +54,9 @@ public async Task IncDecPipeline()
{
IServiceCollection services = new ServiceCollection();
services.AddSingleton<IncrementMiddleware>();
services.AddSingleton<FrameMiddleware, IncrementMiddleware>(
x => x.GetRequiredService<IncrementMiddleware>());
services.AddSingleton<FrameMiddleware, IncrementMiddleware>(x => x.GetRequiredService<IncrementMiddleware>());
services.AddSingleton<DecrementMiddleware>();
services.AddSingleton<FrameMiddleware, DecrementMiddleware>(
x => x.GetRequiredService<DecrementMiddleware>());
services.AddSingleton<FrameMiddleware, DecrementMiddleware>(x => x.GetRequiredService<DecrementMiddleware>());
services.AddSingleton<ITelegramBotClient, StubTelegramBotClient>();
services.AddLogging(builder => builder.AddConsole());
services.AddMetrics();
Expand Down
52 changes: 26 additions & 26 deletions TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,36 @@
switch (request)
{
case GetMeRequest:
{
User user = new()
{
Id = 0,
Username = "TEST",
LanguageCode = "en",
FirstName = "TEST_NAME",
IsBot = true,
};
string json = JsonSerializer.Serialize(user);
return Task.FromResult(JsonSerializer.Deserialize<TResponse>(json)!);
}
User user = new()
{
Id = 0,
Username = "TEST",
LanguageCode = "en",
FirstName = "TEST_NAME",
IsBot = true,
};
string json = JsonSerializer.Serialize(user);
return Task.FromResult(JsonSerializer.Deserialize<TResponse>(json)!);
}
case SendMessageRequest sendMessageRequest:
{
Message message = new()
{
Id = Random.Shared.Next(0),
Chat = new()
Message message = new()
{
Id = sendMessageRequest.ChatId.Identifier.GetValueOrDefault(0L),
Username = sendMessageRequest.ChatId.Username,
Type = ChatType.Private,
},
Text = sendMessageRequest.Text,
MessageThreadId = sendMessageRequest.MessageThreadId,
};
Messages.Enqueue(sendMessageRequest);
string json = JsonSerializer.Serialize(message);
return Task.FromResult(JsonSerializer.Deserialize<TResponse>(json)!);
}
Id = Random.Shared.Next(0),
Chat = new()
{
Id = sendMessageRequest.ChatId.Identifier.GetValueOrDefault(0L),
Username = sendMessageRequest.ChatId.Username,
Type = ChatType.Private,
},
Text = sendMessageRequest.Text,
MessageThreadId = sendMessageRequest.MessageThreadId,
};
Messages.Enqueue(sendMessageRequest);
string json = JsonSerializer.Serialize(message);
return Task.FromResult(JsonSerializer.Deserialize<TResponse>(json)!);
}
default:
throw new NotImplementedException();
}
Expand All @@ -66,5 +66,5 @@
public long BotId => -1;
public TimeSpan Timeout { get; set; } = TimeSpan.MaxValue;
public IExceptionParser ExceptionsParser { get; set; } = new DefaultExceptionParser();
public event AsyncEventHandler<ApiRequestEventArgs>? OnMakingApiRequest;

Check warning on line 69 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnMakingApiRequest' is never used

Check warning on line 69 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnMakingApiRequest' is never used

Check warning on line 69 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnMakingApiRequest' is never used

Check warning on line 69 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnMakingApiRequest' is never used
public event AsyncEventHandler<ApiResponseEventArgs>? OnApiResponseReceived;

Check warning on line 70 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnApiResponseReceived' is never used

Check warning on line 70 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnApiResponseReceived' is never used

Check warning on line 70 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnApiResponseReceived' is never used

Check warning on line 70 in TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs

View workflow job for this annotation

GitHub Actions / build

The event 'StubTelegramBotClient.OnApiResponseReceived' is never used
Expand Down
2 changes: 1 addition & 1 deletion TgBotFrame/TgBotFrame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.2.10</Version>
<Version>2.0.0</Version>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>telegram,tg,commands,bot</PackageTags>
Expand Down