mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
#nullable enable
|
|
|
|
using System.Threading.Tasks;
|
|
using BotFramework.Attributes;
|
|
using BotFramework.Enums;
|
|
using Kruzya.TelegramBot.Core.Data;
|
|
using Kruzya.TelegramBot.Core.Extensions;
|
|
|
|
namespace West.TelegramBot.ChatManagement.Handler.Fun
|
|
{
|
|
public class Python : AbstractAnimationReply
|
|
{
|
|
protected override string GetAnimationName()
|
|
{
|
|
return "python";
|
|
}
|
|
|
|
[Command(InChat.Public, "setpython", CommandParseMode.Both)]
|
|
public async Task HandleSetPython()
|
|
{
|
|
await HandleSetAnimation();
|
|
}
|
|
|
|
[Message(InChat.Public, "(?i)питон|пайтон|python|путхон", MessageFlag.HasText, true)]
|
|
public async Task HandlePython()
|
|
{
|
|
// var cmdEntity = Message?.Entities?.Find(e => e.Type == MessageEntityType.BotCommand);
|
|
// if (cmdEntity is { Length: > 0 })
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
if (Message!.Text!.Contains("/setpython"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
await HandleAnimation();
|
|
}
|
|
|
|
private async Task<BotUserValue> GetPythonFileOption()
|
|
{
|
|
return await Db.UserValues.FindOrCreateOption(Chat.Id, "pythonFile");
|
|
}
|
|
|
|
public Python(CoreContext db) : base(db) { }
|
|
}
|
|
} |