Skip to content

Instantly share code, notes, and snippets.

@joetechem
Last active September 18, 2017 18:38
Show Gist options
  • Save joetechem/2c301718440a841e9cf3614f8a2683c4 to your computer and use it in GitHub Desktop.
Save joetechem/2c301718440a841e9cf3614f8a2683c4 to your computer and use it in GitHub Desktop.
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