public CGenderSelectionState(CUser user)
 {
     _user          = user;
     AnswerKeyboard = new ReplyKeyboardMarkup(new List <KeyboardButton>
     {
         new KeyboardButton
         {
             Text = "М"
         },
         new KeyboardButton
         {
             Text = "Ж"
         }
     }, oneTimeKeyboard: true);
 }
Example #2
0
        private async void BotOnUpdate(object sender, UpdateEventArgs e)
        {
            if (e.Update.CallbackQuery != null || e.Update.InlineQuery != null)
            {
                return; // inline and callback queries are handling separately
            }
            Update  update  = e.Update;
            Message message = update.Message;

            if (message == null)
            {
                return;
            }

            switch (message.Type)
            {
            case MessageType.Text:
                CInputProcessingEngine.Instance.ProccessMessage(_session, message);
                CUser   currentUser   = _session.GetUser(message.Chat.Id);
                Boolean skipUserInput = false;
                do
                {
                    String answer;
                    ReplyKeyboardMarkup keyboard;
                    skipUserInput = currentUser.CurrentState.SkipUserInput;
                    currentUser.GenerateAnswer(out answer, out keyboard);
                    if (answer == null)
                    {
                        await _bot.LeaveChatAsync(message.Chat.Id);

                        return;
                    }
                    if (keyboard != null)
                    {
                        await _bot.SendTextMessageAsync(currentUser.Id, answer, ParseMode.Default, false, false, 0, keyboard);
                    }
                    else
                    {
                        await _bot.SendTextMessageAsync(currentUser.Id, answer);
                    }
                } while (skipUserInput);

                break;

            default:
                throw new NotSupportedException();
            }
        }
Example #3
0
 public CEarsOperationInformationState(CUser user)
 {
     _user = user;
 }
 public CSymptomsDiagnosisState(CUser user)
 {
     SkipUserInput  = true;
     AnswerKeyboard = null;
     _user          = user;
 }
Example #5
0
 public CDefaultUserState(CUser user)
 {
     _user = user;
 }
Example #6
0
 public CAgeSelectionState(CUser user)
 {
     _user = user;
 }
 public CDrugSelectionState(CUser user)
 {
     _user = user;
 }
 public CDeseasedBodyPartDetectionState(CUser user)
 {
     _user = user;
 }
Example #9
0
 public CHypersensitivityDetectionState(CUser user)
 {
     _user = user;
 }
 public CСontraindicationsState(CUser user)
 {
     _user = user;
 }