mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Update to Telegram Bot Framework 2.0
This commit is contained in:
@@ -12,7 +12,8 @@ namespace West.TelegramBot.ChatManagement.Handler;
|
||||
|
||||
public partial class BanStickerSet
|
||||
{
|
||||
[ParametrizedCommand(InChat.Public, "stick_ban", CommandParseMode.Both)]
|
||||
[InChat(InChat.Public)]
|
||||
[ParametrizedCommand("stick_ban", CommandParseMode.Both)]
|
||||
public async Task HandleBanSticker(StickerSet.Param stickerSet)
|
||||
{
|
||||
if (!await PreCommand(stickerSet))
|
||||
@@ -43,7 +44,8 @@ public partial class BanStickerSet
|
||||
await Reply(FormatStickerSetAction(stickerSet.Set, "заблокирован"));
|
||||
}
|
||||
|
||||
[ParametrizedCommand(InChat.Public, "stick_unban", CommandParseMode.Both)]
|
||||
[InChat(InChat.Public)]
|
||||
[ParametrizedCommand("stick_unban", CommandParseMode.Both)]
|
||||
public async Task HandleUnBanSticker(string stickerSet)
|
||||
{
|
||||
if (!await PreCommand())
|
||||
@@ -68,7 +70,8 @@ public partial class BanStickerSet
|
||||
await Reply(FormatStickerSetAction(stickerSet, "разблокирован"));
|
||||
}
|
||||
|
||||
[Command(InChat.Public, "stick_banlist", CommandParseMode.Both)]
|
||||
[InChat(InChat.Public)]
|
||||
[Command("stick_banlist", CommandParseMode.Both)]
|
||||
public async Task HandleSBanList()
|
||||
{
|
||||
var option = await GetBannedStickerSetOption();
|
||||
@@ -109,7 +112,8 @@ public partial class BanStickerSet
|
||||
await Reply(msg);
|
||||
}
|
||||
|
||||
[Message(InChat.Public, MessageFlag.HasSticker)]
|
||||
[InChat(InChat.Public)]
|
||||
[Message(MessageFlag.HasSticker)]
|
||||
public async Task HandleMessage()
|
||||
{
|
||||
var message = Message!;
|
||||
|
||||
@@ -21,7 +21,8 @@ public class Greet : BotEventHandler
|
||||
_rulesService = rulesService;
|
||||
}
|
||||
|
||||
[Message(InChat.Public, MessageFlag.HasNewChatMembers)]
|
||||
[InChat(InChat.Public)]
|
||||
[Message(MessageFlag.HasNewChatMembers)]
|
||||
public async Task HandleNewChatMembers()
|
||||
{
|
||||
var message = RawUpdate.Message!;
|
||||
|
||||
@@ -14,7 +14,8 @@ class Rules : CommonHandler
|
||||
{
|
||||
private readonly RulesService _rulesService;
|
||||
|
||||
[Command(InChat.Public, "setrules", CommandParseMode.Both)]
|
||||
[InChat(InChat.Public)]
|
||||
[Command("setrules", CommandParseMode.Both)]
|
||||
public async Task HandleSetRules()
|
||||
{
|
||||
var replyToMessage = Message?.ReplyToMessage;
|
||||
@@ -27,7 +28,8 @@ class Rules : CommonHandler
|
||||
await _rulesService.SetRulesAsync(Chat, replyToMessage.MessageId);
|
||||
}
|
||||
|
||||
[Command(InChat.Public, "rules", CommandParseMode.Both)]
|
||||
[InChat(InChat.Public)]
|
||||
[Command("rules", CommandParseMode.Both)]
|
||||
public async Task HandleRules()
|
||||
{
|
||||
if (!await _rulesService.HasRulesAsync(Chat))
|
||||
|
||||
Reference in New Issue
Block a user