core: cleanup codebase, move to f-string formatting
This commit is contained in:
parent
11acdb6fd4
commit
56c45d1beb
10
main.py
10
main.py
|
@ -104,7 +104,7 @@ class ModuleControlUnit:
|
|||
def reload_modules(self):
|
||||
for folder in os.listdir("modules/"):
|
||||
try:
|
||||
meta_raw = readfile("modules/{}/meta.json".format(folder))
|
||||
meta_raw = readfile(f"modules/{folder}/meta.json")
|
||||
if not meta_raw:
|
||||
print(f"[WARN] module_loader: no meta.json found in module folder \"{folder}\"")
|
||||
continue
|
||||
|
@ -117,9 +117,9 @@ class ModuleControlUnit:
|
|||
else:
|
||||
index_file = "index.py"
|
||||
|
||||
code = readfile( "modules/{}/{}".format(folder, index_file) )
|
||||
code = readfile(f"modules/{folder}/{index_file}")
|
||||
if not code: # False both when readfile() returns False and when the code string is empty
|
||||
print("[WARN] reload_modules: module {} does not have any code, skipping...".format(folder))
|
||||
print(f"[WARN] reload_modules: module {folder} does not have any code, skipping...")
|
||||
continue
|
||||
|
||||
if "start_on_boot" in meta:
|
||||
|
@ -133,7 +133,7 @@ class ModuleControlUnit:
|
|||
alias = None
|
||||
|
||||
if "predefine" in meta:
|
||||
predefine = readfile("modules/{}/{}".format(folder, meta["predefine"]))
|
||||
predefine = readfile(f"modules/{folder}/{meta['predefine']}")
|
||||
else:
|
||||
predefine = False
|
||||
|
||||
|
@ -178,7 +178,7 @@ def queue_processor():
|
|||
if len(message_queue) > 0:
|
||||
msg = message_queue[0]
|
||||
del message_queue[0]
|
||||
print("[DEBUG] queue_processor: {}".format(msg)) # debug
|
||||
print(f"[DEBUG] queue_processor: {msg}") # debug
|
||||
|
||||
# check for control commands
|
||||
if msg.chat.id == 575246355:
|
||||
|
|
Loading…
Reference in New Issue