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
+12 -6
View File
@@ -55,7 +55,10 @@ public class Reputation : CommonHandler
_logger = logger;
}
[Message(InChat.Public, MessageFlag.HasText | MessageFlag.HasSticker)]
[InChat(InChat.Public)]
[HandleCondition(ConditionType.Any)]
[Message(MessageFlag.HasText)]
[Message(MessageFlag.HasSticker)]
public async Task HandleReputation()
{
var text = Message?.Text;
@@ -124,8 +127,9 @@ public class Reputation : CommonHandler
$"{action} репутацию </code>{receiver.ToHtml()}<code>({Math.Round(receiverRepCount, 2)})</code>");
}
}
[ParametrizedCommand(InChat.Public, "setrep", CommandParseMode.Both)]
[InChat(InChat.Public)]
[ParametrizedCommand("setrep", CommandParseMode.Both)]
public async Task HandleSetRep(double reputation)
{
if (!CanModifyUserReputation(RepliedUser))
@@ -138,7 +142,8 @@ public class Reputation : CommonHandler
);
}
[ParametrizedCommand(InChat.Public, "addrep", CommandParseMode.Both)]
[InChat(InChat.Public)]
[ParametrizedCommand("addrep", CommandParseMode.Both)]
public async Task HandleAddRep(double reputation)
{
if (!CanModifyUserReputation(RepliedUser))
@@ -150,8 +155,9 @@ public class Reputation : CommonHandler
await _reputationService.IncrementReputationAsync(Chat, RepliedUser, reputation)
);
}
[Command(InChat.Public, "top", CommandParseMode.Both)]
[InChat(InChat.Public)]
[Command("top", CommandParseMode.Both)]
public async Task HandleTop()
{
var msg = new HtmlString();