File tree Expand file tree Collapse file tree 1 file changed +0
-25
lines changed Expand file tree Collapse file tree 1 file changed +0
-25
lines changed Original file line number Diff line number Diff line change 5
5
Make general actions for Marvin, one function for each action.
6
6
"""
7
7
import datetime
8
- import json
9
8
import random
10
9
11
- # Load all strings from file
12
- with open ("marvin_strings.json" , encoding = "utf-8" ) as f :
13
- STRINGS = json .load (f )
14
-
15
10
lastDateGreeted = None
16
11
17
12
18
- def getString (key , key1 = None ):
19
- """
20
- Get a string from the string database.
21
- """
22
- data = STRINGS [key ]
23
- if isinstance (data , list ):
24
- res = data [random .randint (0 , len (data ) - 1 )]
25
- elif isinstance (data , dict ):
26
- if key1 is None :
27
- res = data
28
- else :
29
- res = data [key1 ]
30
- if isinstance (res , list ):
31
- res = res [random .randint (0 , len (res ) - 1 )]
32
- elif isinstance (data , str ):
33
- res = data
34
-
35
- return res
36
-
37
-
38
13
def getAllGeneralActions ():
39
14
"""
40
15
Return all general actions as an array.
You can’t perform that action at this time.
0 commit comments