2022-01-02 21:56:14 +02:00
|
|
|
#nullable enable
|
|
|
|
|
|
2022-01-04 17:45:06 +02:00
|
|
|
using System;
|
2022-01-02 21:56:14 +02:00
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using BotFramework.Attributes;
|
|
|
|
|
using BotFramework.Enums;
|
|
|
|
|
using Kruzya.TelegramBot.Core.Data;
|
2022-01-03 15:55:42 +02:00
|
|
|
using Microsoft.Extensions.Logging;
|
2022-01-02 21:56:14 +02:00
|
|
|
using Telegram.Bot;
|
|
|
|
|
|
|
|
|
|
namespace West.Entertainment.Handler.Fun
|
|
|
|
|
{
|
|
|
|
|
public class Bayan : AbstractAnimationReply
|
|
|
|
|
{
|
2022-01-04 17:45:06 +02:00
|
|
|
protected override TimeSpan Cooldown => TimeSpan.Zero;
|
|
|
|
|
|
2022-01-03 15:55:42 +02:00
|
|
|
public Bayan(CoreContext db, ILogger<Bayan> logger) : base(db, logger) { }
|
2022-01-02 21:56:14 +02:00
|
|
|
|
2022-01-03 14:58:53 +02:00
|
|
|
protected override Regex AnimationMatch
|
2022-01-03 15:17:11 +02:00
|
|
|
=> new("^баян$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
2022-01-02 21:56:14 +02:00
|
|
|
|
2022-01-03 14:58:53 +02:00
|
|
|
protected override string GetAnimationName()
|
|
|
|
|
=> "bayan";
|
2022-01-02 21:56:14 +02:00
|
|
|
|
|
|
|
|
[Command(InChat.Public, "setbayan", CommandParseMode.Both)]
|
2022-01-03 14:58:53 +02:00
|
|
|
public async Task HandleSetBayan()
|
|
|
|
|
=> await HandleSetAnimation();
|
2022-01-02 21:56:14 +02:00
|
|
|
|
2022-01-03 14:58:53 +02:00
|
|
|
[Message(InChat.Public, MessageFlag.HasText)]
|
2022-01-03 22:14:59 +02:00
|
|
|
public async Task HandleBayan()
|
2022-01-02 21:56:14 +02:00
|
|
|
{
|
2022-01-03 22:14:59 +02:00
|
|
|
if (await HandleAnimation())
|
2022-01-02 21:56:14 +02:00
|
|
|
{
|
|
|
|
|
await Bot.DeleteMessageAsync(Chat.Id, Message!.MessageId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-03 14:58:53 +02:00
|
|
|
protected override int? GetMessageIdToReply()
|
|
|
|
|
{
|
|
|
|
|
return Message!.ReplyToMessage!.MessageId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool CanHandle()
|
|
|
|
|
=> Message?.ReplyToMessage != null;
|
2022-01-02 21:56:14 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|