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

34 lines
1.1 KiB
C#
Raw Normal View History

2022-01-02 21:56:14 +02:00
#nullable enable
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BotFramework.Attributes;
using BotFramework.Enums;
using Kruzya.TelegramBot.Core.Data;
namespace West.Entertainment.Handler.Fun
{
public class Python : AbstractAnimationReply
{
protected override Regex AnimationMatch =>
new("питон|пайтон|python|путхон|питухон|петухон",
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
2022-01-02 21:56:14 +02:00
2022-01-03 14:58:53 +02:00
protected override string GetAnimationName()
=> "python";
2022-01-02 21:56:14 +02:00
2022-01-03 14:58:53 +02:00
protected override bool CanHandle()
=> !Message!.Text!.Contains("/setpython");
2022-01-02 21:56:14 +02:00
[Command(InChat.Public, "setpython", CommandParseMode.Both)]
2022-01-03 14:58:53 +02:00
public async Task HandleSetPython()
=> await HandleSetAnimation();
[Message(InChat.Public, MessageFlag.HasText)]
public override async Task<bool> HandleAnimation()
=> await base.HandleAnimation();
2022-01-02 21:56:14 +02:00
public Python(CoreContext db) : base(db) { }
}
}