added safe mode to jokes settings

This commit is contained in:
Justin 2023-07-17 14:37:21 +08:00 committed by GitHub
parent 8e28fcbdba
commit 8e5e100859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,7 +342,7 @@ def index():
if not jokes_settings['categories']: if not jokes_settings['categories']:
jokes_settings['categories'] = ['Any'] jokes_settings['categories'] = ['Any']
except: except:
jokes_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []} jokes_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "safe": True, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []}
try: try:
f = open('csv/scheduler.json','r') f = open('csv/scheduler.json','r')
@ -1346,12 +1346,13 @@ def save_jokes_settings(input_settings):
current_settings = json.load(f) current_settings = json.load(f)
f.close() f.close()
except: except:
current_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []} current_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "safe": True, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []}
current_settings['speed'] = input_settings['speed'].lower() current_settings['speed'] = input_settings['speed'].lower()
current_settings['speed2'] = input_settings['speed2'].lower() current_settings['speed2'] = input_settings['speed2'].lower()
current_settings['animation'] = input_settings['animation'].lower() current_settings['animation'] = input_settings['animation'].lower()
current_settings['title'] = input_settings['title'] current_settings['title'] = input_settings['title']
current_settings['safe'] = input_settings['safe']
if not input_settings['categories']: if not input_settings['categories']:
current_settings['categories'] = ['Any'] current_settings['categories'] = ['Any']
else: else: