def story_check_command(self, line, echo_hit):
        # If self.last_user_input equal to "echo 1" or "echo 3"
        if line in story_replies:

            if line == "echo 1":
                return True

            else:
                if echo_hit[line]:
                    echo_hit[line] = False
                    reply = pop_story(line)["clara"]
                    self.send_hint("\n\n" + reply)

                    # Record that the user got optional info
                    # Replace spaces with underscores
                    user_input = "_".join(line.split(" "))
                    state_name = "clara_%s" % user_input
                    record_user_interaction(self, state_name)
                else:
                    self.send_hint(
                        _("\n{{rb:You've already asked Clara that. Ask her something else.}}")
                    )

        else:
            return StepTemplateNano.check_command(self, line)
示例#2
0
    def check_command(self):

        # If self.last_user_input equal to "echo 1" or "echo 3"
        if self.last_user_input in story_replies:

            if self.last_user_input == "echo 1":
                return True

            else:
                if self.echo_hit[self.last_user_input]:
                    self.echo_hit[self.last_user_input] = False
                    reply = pop_story(self.last_user_input)["clara"]
                    self.send_text("\n\n" + reply)

                    # Record that the user got optional info
                    # Replace spaces with underscores
                    user_input = "_".join(self.last_user_input.split(" "))
                    state_name = "clara_%s" % user_input
                    record_user_interaction(self, state_name)
                else:
                    self.send_text(
                        _("\n{{rb:You've already asked Clara that. " +\
                        "Ask her something else.}}")
                    )

        else:
            return TerminalNanoBernard.check_command(self)
示例#3
0
    def check_command(self):
        if self.last_user_input == "cat Eleanor":
            self.eleanor_speaks()
            record_user_interaction(self, "cat_eleanor")

        else:
            return TerminalNano.check_command(self)
示例#4
0
    def check_command(self):

        # If self.last_user_input equal to "echo 1" or "echo 3"
        if self.last_user_input in story_replies:

            if self.last_user_input == "echo 1":
                return True

            else:
                if self.echo_hit[self.last_user_input]:
                    self.echo_hit[self.last_user_input] = False
                    reply = pop_story(self.last_user_input)["clara"]
                    self.send_text("\n\n" + reply)

                    # Record that the user got optional info
                    # Replace spaces with underscores
                    user_input = "_".join(self.last_user_input.split(" "))
                    state_name = "clara_{}".format(user_input)
                    record_user_interaction(self, state_name)
                else:
                    self.send_text(
                        "\n{{rb:Questo l'hai già chiesto a Clara. "
                        "Domandale qualcos'altro.}}"
                    )

        else:
            return TerminalNanoBernard.check_command(self)
示例#5
0
    def story_check_command(self, line, echo_hit):
        # If self.last_user_input equal to "echo 1" or "echo 3"
        if line in story_replies:

            if line == "echo 1":
                return True

            else:
                if echo_hit[line]:
                    echo_hit[line] = False
                    reply = pop_story(line)["clara"]
                    self.send_hint("\n\n" + reply)

                    # Record that the user got optional info
                    # Replace spaces with underscores
                    user_input = "_".join(line.split(" "))
                    state_name = "clara_%s" % user_input
                    record_user_interaction(self, state_name)
                else:
                    self.send_hint(
                        _("\n{{rb:You've already asked Clara that. Ask her something else.}}"
                          ))

        else:
            return StepTemplateNano.check_command(self, line)
示例#6
0
    def check_command(self):

        # If self.last_user_input equal to "echo 1" or "echo 3"
        if self.last_user_input in story_replies:

            if self.last_user_input == "echo 1":
                return True

            else:
                if self.echo_hit[self.last_user_input]:
                    self.echo_hit[self.last_user_input] = False
                    reply = pop_story(self.last_user_input)["clara"]
                    self.send_text("\n\n" + reply)

                    # Record that the user got optional info
                    # Replace spaces with underscores
                    user_input = "_".join(self.last_user_input.split(" "))
                    state_name = "clara_{}".format(user_input)
                    record_user_interaction(self, state_name)
                else:
                    self.send_text(
                        "\n{{rb:You've already asked Clara that. "
                        "Ask her something else.}}"
                    )

        else:
            return TerminalNanoBernard.check_command(self)
 def _companion_speaks(self, line):
     """
     :param line: last line user typed
     :return: boolean, depending on whether the companion spoke
     """
     if line == self.companion_command and self.companion_speech:
         self.send_hint("\n" + self.companion_speech)
         record_user_interaction(self, "_".join(self.companion_command.split(" ")))
         return True
     return False
示例#8
0
 def _companion_speaks(self, line):
     """
     :param line: last line user typed
     :return: boolean, depending on whether the companion spoke
     """
     if line == self.companion_command and self.companion_speech:
         self.send_hint("\n" + self.companion_speech)
         record_user_interaction(
             self, "_".join(self.companion_command.split(" ")))
         return True
     return False