Ejemplo n.º 1
0
 def _add_fsm_and_user(self, update, hard=False):
     if update.effective_chat.id not in self._chat_fsm:
         fsm = BotBrain(self._bot, update.effective_user,
                        update.effective_chat, self._text_and_qa())
         self._chat_fsm[update.effective_chat.id] = fsm
         self._users[update.effective_user.id] = update.effective_user
     elif update.effective_user.id in self._chat_fsm and hard:
         self._chat_fsm[update.effective_chat.id].clear_all()
         del self._chat_fsm[update.effective_chat.id]
         fsm = BotBrain(self._bot, update.effective_user,
                        update.effective_chat, self._text_and_qa())
         self._chat_fsm[update.effective_chat.id] = fsm
         self._users[update.effective_user.id] = update.effective_user
Ejemplo n.º 2
0
def add_fsm_and_user(update, bot, text_and_qa, hard=False):
    if update.effective_chat.id not in chat_fsm:
        fsm = BotBrain(bot, update.effective_user, update.effective_chat, text_and_qa)
        chat_fsm[update.effective_chat.id] = fsm
    elif update.effective_user.id in chat_fsm and hard:
        chat_fsm[update.effective_chat.id].reinit_text_based_skills_and_data(text_and_qa)
        chat_fsm[update.effective_chat.id].clear_all()
Ejemplo n.º 3
0
 def _create_fsm(self, update):
     fsm = BotBrain(self._bot, update.effective_user, update.effective_chat, self._text_and_qa())
     self._users_fsm[update.effective_user.id] = fsm
     self._users[update.effective_user.id] = update.effective_user