fix(config): improve reply loading and handle missing file

This commit is contained in:
2026-07-29 18:28:47 +05:00
parent 9ae5a077a4
commit 9478f7d793
+8 -6
View File
@@ -16,17 +16,19 @@ class Config:
try: try:
reply_lines = [] reply_lines = []
with open(file_path, "r", encoding="utf-8") as replies: with open(file_path, "r", encoding="utf-8") as replies:
lines = replies.readlines() for line in replies:
line = line.rstrip("\n")
for line_index, line in enumerate(lines): if not line:
continue
if " || " in line: if " || " in line:
options = line.split(" || ") options = [o.strip() for o in line.split(" || ")]
else: else:
options = [line] options = [line]
reply_lines.append(options)
reply_lines[line_index] = options return reply_lines if reply_lines else [[""]]
except: except FileNotFoundError:
return [[""]] return [[""]]
def _load(self): def _load(self):