Add \n conversion support for ads too
Build and Push (dev) / build (push) Successful in 33s

This commit is contained in:
2026-09-03 16:24:52 +00:00
parent 2f9efed5e0
commit 4d1f1eabf0
+3 -2
View File
@@ -43,12 +43,13 @@ class Config:
return default_replies return default_replies
def _load_ads(self, file_path: str = "storage/ads.txt"): def _load_ads(self, file_path: str = "storage/ads.txt"):
"""Load ad content from file (single ad, no multi-line conversion needed)""" """Load ad content from file (can be multi-line with actual line breaks or \\n)"""
try: try:
with open(file_path, "r", encoding="utf-8") as f: with open(file_path, "r", encoding="utf-8") as f:
ad_content = f.read().strip() ad_content = f.read().strip()
if ad_content: if ad_content:
return ad_content # Convert literal \n to actual newlines for ads too
return ad_content.replace("\\n", "\n")
return None return None
except FileNotFoundError: except FileNotFoundError:
logger.warning(f"Ad file {file_path} not found") logger.warning(f"Ad file {file_path} not found")