-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathmarvin_general_actions.py
More file actions
50 lines (41 loc) · 952 Bytes
/
marvin_general_actions.py
File metadata and controls
50 lines (41 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make general actions for Marvin, one function for each action.
"""
import datetime
import random
lastDateGreeted = None
def getAllGeneralActions():
"""
Return all general actions as an array.
"""
return [
marvinMorning
]
def marvinMorning(row):
"""
Marvin says Good morning after someone else says it
"""
msg = None
phrases = [
"morgon",
"godmorgon",
"god morgon",
"morrn",
"morn"
]
morning_phrases = [
"Godmorgon! :-)",
"Morgon allesammans",
"Morgon gott folk",
"Guten morgen",
"Morgon"
]
global lastDateGreeted
for phrase in phrases:
if phrase in row:
if lastDateGreeted != datetime.date.today():
lastDateGreeted = datetime.date.today()
msg = random.choice(morning_phrases)
return msg