Esempio n. 1
0
        private SupportedAction GetAction(Message message, CommandBase <Bot, Config> command)
        {
            if (message.ForwardFrom != null)
            {
                if ((CurrentQuery != null) && (message.Date > CurrentQueryTime))
                {
                    CurrentQuery = null;
                }
                return(new ForwardAction(this, message));
            }

            if (command != null)
            {
                return(new CommandAction(this, message, command));
            }

            if (int.TryParse(message.Text, out int number))
            {
                return(new NumberAction(this, message, number));
            }

            if (Articles.Manager.TryParseArticle(message.Text, out Article article))
            {
                return(new ArticleAction(this, message, article));
            }

            if (FindQuery.TryParseFindQuery(message.Text, out FindQuery findQuery))
            {
                return(new FindQueryAction(this, message, findQuery));
            }

            if (MarkQuery.TryParseMarkQuery(message.Text, out MarkQuery markQuery))
            {
                if (message.ReplyToMessage == null)
                {
                    return(new RememberMarkAction(this, message, markQuery));
                }

                if (message.ReplyToMessage.ForwardFrom != null)
                {
                    return(new MarkAction(this, message, message.ReplyToMessage, markQuery));
                }
            }

            return(null);
        }
 public MarkAction(Bot.Bot bot, Message message, Message recordMessage, MarkQuery query)
     : base(bot, message)
 {
     _recordMessage = recordMessage;
     _query         = query;
 }
 public RememberMarkAction(Bot.Bot bot, Message message, MarkQuery query) : base(bot, message)
 {
     _query = query;
 }