mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
|
|
#nullable enable
|
||
|
|
|
||
|
|
using System.Text.RegularExpressions;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
using BotFramework.Attributes;
|
||
|
|
using BotFramework.Enums;
|
||
|
|
using Kruzya.TelegramBot.Core.Data;
|
||
|
|
using Telegram.Bot;
|
||
|
|
|
||
|
|
namespace West.Entertainment.Handler.Fun
|
||
|
|
{
|
||
|
|
public class Bayan : AbstractAnimationReply
|
||
|
|
{
|
||
|
|
public Bayan(CoreContext db) : base(db) { }
|
||
|
|
|
||
|
|
protected override Regex AnimationMatch => new("^баян$", RegexOptions.IgnoreCase);
|
||
|
|
|
||
|
|
protected override string GetAnimationName() => "bayan";
|
||
|
|
|
||
|
|
|
||
|
|
[Command(InChat.Public, "setbayan", CommandParseMode.Both)]
|
||
|
|
public async Task HandleSetBayan() => await HandleSetAnimation();
|
||
|
|
|
||
|
|
protected override async Task<bool> HandleAnimation(int? replyToMessageId = null)
|
||
|
|
{
|
||
|
|
if (await base.HandleAnimation(replyToMessageId))
|
||
|
|
{
|
||
|
|
await Bot.DeleteMessageAsync(Chat.Id, Message!.MessageId);
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override bool CanHandle() => Message?.ReplyToMessage != null;
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|