2022-01-03 20:58:26 +02:00
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using BotFramework.Attributes;
|
|
|
|
|
using BotFramework.Enums;
|
2023-01-17 23:13:06 +02:00
|
|
|
using Kruzya.TelegramBot.Core;
|
2022-01-03 20:58:26 +02:00
|
|
|
using Kruzya.TelegramBot.Core.Data;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
|
|
namespace West.Entertainment.Handler.Fun
|
|
|
|
|
{
|
|
|
|
|
public class JavaScript : AbstractAnimationReply
|
|
|
|
|
{
|
2023-01-17 23:13:06 +02:00
|
|
|
public JavaScript(CoreContext db, ILogger<JavaScript> logger, ThreadSafeRandom rng) : base(db, logger, rng) { }
|
2022-01-03 20:58:26 +02:00
|
|
|
|
|
|
|
|
protected override Regex AnimationMatch => new(
|
2022-02-08 15:17:25 +02:00
|
|
|
@"((?<![\w])(жс|js|v8)(?![\w]))|жаваскрипт|javascript|жопаскрипт|жиес|жиэс|nodejs",
|
2022-01-03 20:58:26 +02:00
|
|
|
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
|
|
|
|
|
|
|
|
|
protected override string GetAnimationName() => "javascript";
|
2023-07-29 01:50:28 +03:00
|
|
|
|
|
|
|
|
[InChat(InChat.Public)]
|
|
|
|
|
[Command("setjs", CommandParseMode.Both)]
|
2022-01-03 20:58:26 +02:00
|
|
|
public async Task HandleSetJs()
|
|
|
|
|
=> await HandleSetAnimation();
|
2022-01-03 22:14:59 +02:00
|
|
|
|
2023-07-29 01:50:28 +03:00
|
|
|
[InChat(InChat.Public)]
|
|
|
|
|
[Message(MessageFlag.HasText)]
|
2022-01-03 22:14:59 +02:00
|
|
|
public async Task HandleJs()
|
|
|
|
|
{
|
|
|
|
|
await HandleAnimation();
|
|
|
|
|
}
|
2022-01-03 20:58:26 +02:00
|
|
|
}
|
|
|
|
|
}
|