using TelegramBotBase.Base; using TelegramBotBase.Form; namespace TelegramBotBase.Experiments.ActionManager.Actions { public class StartWithAction : IExternalAction { public string SearchForString { get; set; } public Action SetProperty { get; set; } Func Action; public StartWithAction(string searchFor, Func action) { SearchForString = searchFor; Action = action; } public bool DoesFit(string raw_data) => raw_data.StartsWith(SearchForString); public async Task DoAction(UpdateResult ur, MessageResult mr) => await Action(mr.RawData, ur, mr); } public static class StartWithAction_Extensions { public static void AddStartsWithAction(this ExternalActionManager manager, string value, Func action) { manager.Add(new StartWithAction(value, action)); } } }