Files
2021-12-29 00:57:37 +02:00

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) { }
}
}