public FollowCommand(PyTaskDatabase db, Dictionary <long, List <string> > storage, string[] followAliases) : base("follow", "subscribe to updates") { this.storage = storage; this.db = db; this.followAliases = followAliases; }
public ListTaskInCategoryCommand(PyTaskDatabase db) : base("catinfo", "show list of tasks in category") { this.db = db; foreach (var x in db.CategoriesSet) { Aliases.Add(x); } }
public TaskInfoCommand(PyTaskDatabase db) : base("info", "give info about the task") { taskWrapper = new TaskWrapper(); this.db = db; foreach (var x in db.TasksNamesSet) { Aliases.Add(x); } }
private static Executor CreateExecutor(PyTaskDatabase ptdb, Dictionary <long, List <string> > storage) { var executor = new Executor(); executor.Register(new HelpCommand()); executor.Register(new ListTaskCommand(ptdb)); executor.Register(new ListCategoriesCommand(ptdb)); executor.Register(new TaskInfoCommand(ptdb)); executor.Register(new ListTaskInCategoryCommand(ptdb)); executor.Register(new SpecialCommand(ptdb)); executor.Register(new FollowCommand(ptdb, storage, new[] { "фоллоу", "follow", "следить" })); return(executor); }
private static void Main(string[] args) { var db = new PyTaskDatabase("http://pytask.info/db/db_full.json"); var dbUpdater = new Scheduler <Task>(TimeSpan.FromSeconds(30), (sender, e) => { Console.WriteLine(); }); var storage = new Dictionary <long, List <string> >(); var token = ConfigurationManager.AppSettings.Get("token"); if (token == null) { throw new ConfigurationErrorsException("You must specify bot token in configuration file"); } new TelegramBot(token, CreateExecutor(db, storage)).ListenAndAnswer(); }
public SpecialCommand(PyTaskDatabase db) : base("min", "command to take task with some param") { taskWrapper = new TaskWrapper(); this.db = db; Aliases.Add(Regex); }
public ListCategoriesCommand(PyTaskDatabase db) : base("catlist", "get a list of categories names") { this.db = db; }
public ListTaskCommand(PyTaskDatabase db) : base("list", "show list of tasks") { this.db = db; }