コード例 #1
0
        public void Process(Message msg)
        {
            //if (UpdateTime.AddMilliseconds(HelloLimit) < DateTime.Now && LastHello.AddMilliseconds(HelloLimit) < DateTime.Now)
            //{
            //    LastHello = DateTime.Now;
            //    SendTextMessage(TextGeneration.Messages.Hello()).Wait();
            //}
            Worker.TelegramApi.SendChatActionAsync(msg.Chat.Id, Telegram.Bot.Types.Enums.ChatAction.Typing).Wait();
            if (msg.Type == Telegram.Bot.Types.Enums.MessageType.TextMessage)
            {
                Worker.GeneralApi.Send(msg.Date, msg.Text, msg.Chat.Id.ToString(), msg.Chat.Username, Worker.BotInfo.Username).Wait();
            }

            if (UpdateTime.AddMilliseconds(TimeLimit) < DateTime.Now)
            {
                ExitAll();
            }
            if (HandlersStack.Count > 0)
            {
                var handled = HandlersStack.Peek().Process(msg);
                UpdateTime = DateTime.Now;
                return;
            }
            MainHandler.Process(msg);
        }