Skip to content

Commit

Permalink
Stop loading the strings DB in general actions
Browse files Browse the repository at this point in the history
It was not used.
  • Loading branch information
kh31d4r authored and mosbth committed Oct 15, 2024
1 parent d9d0968 commit 8586646
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions marvin_general_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,11 @@
Make general actions for Marvin, one function for each action.
"""
import datetime
import json
import random

# Load all strings from file
with open("marvin_strings.json", encoding="utf-8") as f:
STRINGS = json.load(f)

lastDateGreeted = None


def getString(key, key1=None):
"""
Get a string from the string database.
"""
data = STRINGS[key]
if isinstance(data, list):
res = data[random.randint(0, len(data) - 1)]
elif isinstance(data, dict):
if key1 is None:
res = data
else:
res = data[key1]
if isinstance(res, list):
res = res[random.randint(0, len(res) - 1)]
elif isinstance(data, str):
res = data

return res


def getAllGeneralActions():
"""
Return all general actions as an array.
Expand Down

0 comments on commit 8586646

Please sign in to comment.