mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
740527d827
- Add UserService. - Add "setrep" command. - Rename confusing methods and variables in AbstractAnimationHandler. - Change Bayan cooldown to Zero. - Add crappy "cooldowns" command.
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
#nullable enable
|
|
|
|
using System;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using BotFramework.Attributes;
|
|
using BotFramework.Enums;
|
|
using Kruzya.TelegramBot.Core.Data;
|
|
using Microsoft.Extensions.Logging;
|
|
using Telegram.Bot;
|
|
|
|
namespace West.Entertainment.Handler.Fun
|
|
{
|
|
public class Bayan : AbstractAnimationReply
|
|
{
|
|
protected override TimeSpan Cooldown => TimeSpan.Zero;
|
|
|
|
public Bayan(CoreContext db, ILogger<Bayan> logger) : base(db, logger) { }
|
|
|
|
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 async Task HandleBayan()
|
|
{
|
|
if (await HandleAnimation())
|
|
{
|
|
await Bot.DeleteMessageAsync(Chat.Id, Message!.MessageId);
|
|
}
|
|
}
|
|
|
|
protected override int? GetMessageIdToReply()
|
|
{
|
|
return Message!.ReplyToMessage!.MessageId;
|
|
}
|
|
|
|
protected override bool CanHandle()
|
|
=> Message?.ReplyToMessage != null;
|
|
|
|
}
|
|
} |