Ejemplo n.º 1
0
        public async void NextStepAsync(Conversation chat, string message)
        {
            var type = training[chat.GetId()];
            var word = activeWord[chat.GetId()];

            var check = chat.CheckWord(type, word, message);

            var text = "";

            if (check)
            {
                text = "Правильно!";
            }
            else
            {
                text = "Неправильно!";
            }

            text = text + " Следующее слово: ";

            var newword = chat.GetTrainingWord(type);

            text = text + newword;

            activeWord[chat.GetId()] = newword;


            await botClient.SendTextMessageAsync(chatId : chat.GetId(), text : text);
        }
Ejemplo n.º 2
0
        public async void DoForStageAsync(AddingState addingState, Conversation chat, string message)
        {
            var word = Buffer[chat.GetId()];
            var text = "";

            switch (addingState)
            {
            case AddingState.Russian:
                word.Russian = message;

                text = "Введите английское значение слова";
                break;

            case AddingState.English:
                word.English = message;

                text = "Введите тематику";
                break;

            case AddingState.Theme:
                word.Theme = message;

                text = "Успешно! Слово " + word.English + " добавлено в словарь. ";

                chat.dictionary.Add(word.Russian, word);

                Buffer.Remove(chat.GetId());
                break;
            }


            await SendCommandText(text, chat.GetId());
        }
Ejemplo n.º 3
0
        public async void StartProcessAsync(Conversation chat)
        {
            Buffer.Add(chat.GetId(), new Word());

            var text = "Введите русское значение слова";

            await SendCommandText(text, chat.GetId());
        }
Ejemplo n.º 4
0
        public void NextStage(string message, Conversation chat)
        {
            var currentstate = ChatAdding[chat.GetId()];

            ChatAdding[chat.GetId()] = currentstate + 1;

            if (ChatAdding[chat.GetId()] == AddingState.Finish)
            {
                chat.IsAddingInProcess = false;
                ChatAdding.Remove(chat.GetId());
            }
        }
Ejemplo n.º 5
0
        public void AddCallBack(Conversation chat)
        {
            trainingChats.Add(chat.GetId(), chat);

            this.botClient.OnCallbackQuery -= Bot_Callback;
            this.botClient.OnCallbackQuery += Bot_Callback;
        }
Ejemplo n.º 6
0
 private async Task SendText(Conversation chat, string text)
 {
     await botClient.SendTextMessageAsync(
         chatId : chat.GetId(),
         text : text
         );
 }
Ejemplo n.º 7
0
 private async Task SendTextWithKeyBoard(Conversation chat, string text, InlineKeyboardMarkup keyboard)
 {
     await botClient.SendTextMessageAsync(
         chatId : chat.GetId(),
         text : text,
         replyMarkup : keyboard
         );
 }
Ejemplo n.º 8
0
 public AddingState GetStage(Conversation chat)
 {
     return(ChatAdding[chat.GetId()]);
 }
Ejemplo n.º 9
0
 public void AddFirstState(Conversation chat)
 {
     ChatAdding.Add(chat.GetId(), AddingState.Russian);
 }