Improved behavior with large text in utils

This commit is contained in:
Profitroll 2022-11-14 18:52:16 +01:00
parent 76d7d7f4c6
commit 8601814642

View File

@ -56,7 +56,11 @@ def configSet(key: str, value, *args: str, file: str = "config"):
for arg in args: for arg in args:
string += f'["{arg}"]' string += f'["{arg}"]'
if type(value) in [str]: if type(value) in [str]:
value.replace("'", "\'").replace('"', '\"')
if len(value) < 30:
string += f'["{key}"] = "{value}"' string += f'["{key}"] = "{value}"'
else:
string += f'["{key}"] = """\n{value}\n"""'
else: else:
string += f'["{key}"] = {value}' string += f'["{key}"] = {value}'
exec(string) exec(string)