* BugFixes

* Added basic command arguments filters
This commit is contained in:
2025-08-10 18:59:31 +04:00
parent 3a88feb5f1
commit a1af9bdc3e
7 changed files with 98 additions and 19 deletions
@@ -29,7 +29,7 @@ namespace Telegrator.Handlers.Components
/// <summary>
/// Gets the allowed return types for branch methods.
/// </summary>
protected virtual Type[] AllowedBranchReturnTypes => [typeof(void), typeof(Task)];
protected virtual Type[] AllowedBranchReturnTypes => [typeof(void), typeof(Task<Result>)];
/// <summary>
/// Gets the cancellation token for the current execution.
@@ -75,10 +75,10 @@ namespace Telegrator.Handlers.Components
Type thisType = GetType();
if (branch.GetParameters().Length != 0)
throw new Exception();
throw new Exception("Branch method must have no parameters.");
if (!AllowedBranchReturnTypes.Any(branch.ReturnType.Equals))
throw new Exception();
throw new Exception("Branch method must have one of allowed return types. [void, Task<Result>]");
try
{