This commit is contained in:
@@ -43,13 +43,12 @@ 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 ads from file, one ad per file (can be multi-line)"""
|
"""Load ad content from file (single ad, no multi-line conversion needed)"""
|
||||||
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:
|
||||||
# Convert literal \n to actual newlines
|
return ad_content
|
||||||
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")
|
||||||
@@ -157,9 +156,6 @@ class Config:
|
|||||||
enable_ads = (
|
enable_ads = (
|
||||||
os.getenv(key="ENABLE_ADS", default="false")
|
os.getenv(key="ENABLE_ADS", default="false")
|
||||||
).lower() == "true"
|
).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 = (
|
proxy_telegram = (
|
||||||
os.getenv(key="PROXY_TELEGRAM", default="false")
|
os.getenv(key="PROXY_TELEGRAM", default="false")
|
||||||
@@ -321,7 +317,6 @@ class Config:
|
|||||||
"captcha_check_interval": captcha_check_interval,
|
"captcha_check_interval": captcha_check_interval,
|
||||||
# Ads
|
# Ads
|
||||||
"enable_ads": enable_ads,
|
"enable_ads": enable_ads,
|
||||||
"ads_probability": ads_probability,
|
|
||||||
# Proxy
|
# Proxy
|
||||||
"proxy_telegram": proxy_telegram,
|
"proxy_telegram": proxy_telegram,
|
||||||
"proxy_lolz": proxy_lolz,
|
"proxy_lolz": proxy_lolz,
|
||||||
|
|||||||
Reference in New Issue
Block a user