Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
command response loop python program
# 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
You can’t perform that action at this time.