コード例 #1
0
def main():
    """Main function that keeps Karen listening and responding"""
    while True:
        karen.listen("")
        user_message = str(karen.userCommand)
        if len(user_message) > 0:
            whattosay = manage_suites.getresponse(user_message)
            karen.speak(whattosay)
コード例 #2
0
def main():
    print(assistant_label + "My name is " + assistant_name +
          " and I am here " + assistant_purpose + ". How may I help you?")
    while manage_suites.is_connected():
        user_message = raw_input('< ')
        if len(user_message) > 0:
            whattosay = manage_suites.getresponse(user_message)
            print_slow(assistant_label + whattosay)
コード例 #3
0
def main(assistant):
    """Main function that keeps Karen listening and responding"""
    while True:
        if assistant.listen():
            user_message = str(assistant.userCommand)
            if len(user_message) > 0:
                whattosay = manage_suites.getresponse(user_message)
                assistant.speak(whattosay)
        else:
            pass
コード例 #4
0
 def handle_command(self, command, channel):
     """
         Receives commands directed at the bot and determines if they
         are valid commands. If so, then acts on the commands. If not,
         returns back what it needs for clarification.
     """
     whattosay = manage_suites.getresponse(command)
     self.slack_client.api_call("chat.postMessage",
                                channel=channel,
                                text=whattosay,
                                as_user=True)
コード例 #5
0
def main():
    while True:
        user_message = raw_input('> ')
        if len(user_message) > 0:
            whattosay = manage_suites.getresponse(user_message)
            print("< " + whattosay)