summaryrefslogtreecommitdiff
path: root/client/modules/Life.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/modules/Life.py')
-rw-r--r--client/modules/Life.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/client/modules/Life.py b/client/modules/Life.py
new file mode 100644
index 0000000..2c79ee1
--- /dev/null
+++ b/client/modules/Life.py
@@ -0,0 +1,32 @@
+import random
+import re
+
+WORDS = ["MEANING", "OF", "LIFE"]
+
+
+def handle(text, mic, profile):
+ """
+ Responds to user-input, typically speech text, by relaying the
+ meaning of life.
+
+ Arguments:
+ text -- user-input, typically transcribed speech
+ mic -- used to interact with the user (for both input and output)
+ profile -- contains information related to the user (e.g., phone number)
+ """
+ messages = ["It's 42, you idiot.",
+ "It's 42. How many times do I have to tell you?"]
+
+ message = random.choice(messages)
+
+ mic.say(message)
+
+
+def isValid(text):
+ """
+ Returns True if the input is related to the meaning of life.
+
+ Arguments:
+ text -- user-input, typically transcribed speech
+ """
+ return bool(re.search(r'\bmeaning of life\b', text, re.IGNORECASE))