Files

39 lines
1.0 KiB
C#
Raw Permalink Normal View History

2021-12-29 00:57:37 +02:00
#nullable enable
using System.Threading.Tasks;
using BotFramework.Attributes;
using BotFramework.Enums;
using Kruzya.TelegramBot.Core.Data;
using Telegram.Bot;
namespace West.TelegramBot.ChatManagement.Handler.Fun
{
public class Bayan : AbstractAnimationReply
{
public Bayan(CoreContext db) : base(db) { }
protected override string GetAnimationName()
{
return "bayan";
}
[Command(InChat.Public, "setbayan", CommandParseMode.Both)]
public async Task HandleSetBayan()
{
await HandleSetAnimation();
}
2021-12-29 02:06:53 +02:00
[Message(InChat.Public, "(?i)баян|боян", MessageFlag.HasText | MessageFlag.IsReply, true)]
2021-12-29 00:57:37 +02:00
public async Task HandleBayan()
{
var msg = Message;
2021-12-29 02:06:53 +02:00
var replyMsg = msg?.ReplyToMessage!;
if (msg == null || !await HandleAnimation(replyMsg.MessageId))
2021-12-29 00:57:37 +02:00
{
return;
}
await Bot.DeleteMessageAsync(Chat.Id, msg.MessageId);
}
}
}