Files
telegram-bot/modules/Entertainment/Handler/Fun/Bayan.cs
T

46 lines
1.3 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.CultureInvariant | RegexOptions.IgnoreCase);
protected override string GetAnimationName()
=> "bayan";
[Command(InChat.Public, "setbayan", CommandParseMode.Both)]
public async Task HandleSetBayan()
=> await HandleSetAnimation();
[Message(InChat.Public, MessageFlag.HasText)]
public override async Task<bool> HandleAnimation()
{
if (await base.HandleAnimation())
{
await Bot.DeleteMessageAsync(Chat.Id, Message!.MessageId);
}
return true;
}
protected override int? GetMessageIdToReply()
{
return Message!.ReplyToMessage!.MessageId;
}
protected override bool CanHandle()
=> Message?.ReplyToMessage != null;
}
}