Files
telegram-bot/modules/Entertainment/Handler/Fun/Python.cs
T
West14 b99614868b Assorted improvements.
- Move BotExtension to Core.
- Update BotFramework
- Fix Fun commands.
- Remove ChatManagement dependency from Entertainment.
2022-01-03 14:58:53 +02:00

33 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;
namespace West.Entertainment.Handler.Fun
{
public class Python : AbstractAnimationReply
{
protected override Regex AnimationMatch =>
new("питон|пайтон|python|путхон|питухон|петухон", RegexOptions.IgnoreCase);
protected override string GetAnimationName()
=> "python";
protected override bool CanHandle()
=> !Message!.Text!.Contains("/setpython");
[Command(InChat.Public, "setpython", CommandParseMode.Both)]
public async Task HandleSetPython()
=> await HandleSetAnimation();
[Message(InChat.Public, MessageFlag.HasText)]
public override async Task<bool> HandleAnimation()
=> await base.HandleAnimation();
public Python(CoreContext db) : base(db) { }
}
}