Update to Telegram Bot Framework 2.0

This commit is contained in:
Andriy
2023-07-29 01:50:28 +03:00
parent 5d06529c92
commit 0677060429
24 changed files with 86 additions and 47 deletions
+7 -3
View File
@@ -27,7 +27,8 @@ public class Roll : CommonHandler
private readonly UserService _userService;
private readonly ConcurrentBag<DeleteRequest> _requests;
[Command(InChat.Public, "roll", CommandParseMode.Both)]
[InChat(InChat.Public)]
[Command("roll", CommandParseMode.Both)]
public async Task HandleRoll()
{
var cdOption = await Db.UserValues.FindOrCreateOption(Chat.Id, From.Id, "rollNextUse");
@@ -77,7 +78,8 @@ public class Roll : CommonHandler
);
}
[Command(InChat.Public, "reset_roll", CommandParseMode.Both)]
[InChat(InChat.Public)]
[Command("reset_roll", CommandParseMode.Both)]
public async Task HandleResetRoll()
{
if (!_userService.IsUserSuper(From))
@@ -99,7 +101,8 @@ public class Roll : CommonHandler
await Reply($"Кулдаун /roll сброшен для чата \"{Chat.Title}\".");
}
[ParametrizedCommand(InChat.Public, "rng_test", CommandParseMode.Both)]
[InChat(InChat.Public)]
[ParametrizedCommand("rng_test", CommandParseMode.Both)]
public async Task HandleRngTest(int minValue, int maxValue)
{
if (!_userService.IsUserSuper(From))
@@ -130,6 +133,7 @@ public class Roll : CommonHandler
await Bot.SendTextMessageAsync(Chat, $"Positive: {positive}.\nNegative: {negative}");
}
protected override async Task<Message> Reply(string text)
{
// TODO: move feature with autocleaning to Core CommonHandler.