Last active
September 18, 2017 18:38
-
-
Save joetechem/2c301718440a841e9cf3614f8a2683c4 to your computer and use it in GitHub Desktop.
command response loop python program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SiliconValleyOfTheSouth | |
# Original Program by Wray at Tech Em Studios | |
# Put your commands here | |
# Keep the values lowercase | |
COMMAND1 = "what?" | |
# Your handling code goes in this function | |
def handle_command(command): | |
""" | |
Determine if the command is valid. If so, take action and return | |
a response, if necessary. | |
""" | |
response = "" | |
if command.find(COMMAND1) >= 0: | |
response = "Huh?" | |
else: | |
response = "Why thank you, I don't know what else to say." | |
return response | |
print ("Hi, I am sirexa, your own personal bot. Awaiting your command.") | |
while True: | |
command = raw_input('\nsirexa -> ') | |
response = handle_command(command) | |
print response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment