예제 #1
0
 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);
     }
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
        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();
        }
예제 #6
0
 public SpecialCommand(PyTaskDatabase db) : base("min", "command to take task with some param")
 {
     taskWrapper = new TaskWrapper();
     this.db     = db;
     Aliases.Add(Regex);
 }
예제 #7
0
 public ListCategoriesCommand(PyTaskDatabase db) : base("catlist", "get a list of categories names")
 {
     this.db = db;
 }
예제 #8
0
 public ListTaskCommand(PyTaskDatabase db) : base("list", "show list of tasks")
 {
     this.db = db;
 }