This commit is contained in:
@@ -43,13 +43,12 @@ class Config:
|
||||
return default_replies
|
||||
|
||||
def _load_ads(self, file_path: str = "storage/ads.txt"):
|
||||
"""Load ads from file, one ad per file (can be multi-line)"""
|
||||
"""Load ad content from file (single ad, no multi-line conversion needed)"""
|
||||
try:
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
ad_content = f.read().strip()
|
||||
if ad_content:
|
||||
# Convert literal \n to actual newlines
|
||||
return ad_content.replace("\\n", "\n")
|
||||
return ad_content
|
||||
return None
|
||||
except FileNotFoundError:
|
||||
logger.warning(f"Ad file {file_path} not found")
|
||||
@@ -157,9 +156,6 @@ class Config:
|
||||
enable_ads = (
|
||||
os.getenv(key="ENABLE_ADS", default="false")
|
||||
).lower() == "true"
|
||||
ads_probability = max(
|
||||
0.0, min(1.0, float(os.getenv(key="ADS_PROBABILITY", default=0.3)))
|
||||
) # Clamp between 0.0 and 1.0
|
||||
|
||||
proxy_telegram = (
|
||||
os.getenv(key="PROXY_TELEGRAM", default="false")
|
||||
@@ -321,7 +317,6 @@ class Config:
|
||||
"captcha_check_interval": captcha_check_interval,
|
||||
# Ads
|
||||
"enable_ads": enable_ads,
|
||||
"ads_probability": ads_probability,
|
||||
# Proxy
|
||||
"proxy_telegram": proxy_telegram,
|
||||
"proxy_lolz": proxy_lolz,
|
||||
|
||||
Reference in New Issue
Block a user