Send ads as separate comment, remove probability logic
Build and Push (dev) / build (push) Successful in 40s
Build and Push (dev) / build (push) Successful in 40s
This commit is contained in:
@@ -288,17 +288,15 @@ class TelegramStarsBot:
|
|||||||
replies = self.config._load_replies()
|
replies = self.config._load_replies()
|
||||||
for reply_options in replies:
|
for reply_options in replies:
|
||||||
reply_message = random.choice(reply_options)
|
reply_message = random.choice(reply_options)
|
||||||
|
await self.lolz_api.create_comment(post_id, reply_message)
|
||||||
|
await asyncio.sleep(self.config.api_delay)
|
||||||
|
|
||||||
# Add ad with probability if ads are enabled
|
# Send ad as a separate comment if enabled
|
||||||
if self.config.enable_ads and random.random() < self.config.ads_probability:
|
if self.config.enable_ads:
|
||||||
ad_content = self.config._load_ads()
|
ad_content = self.config._load_ads()
|
||||||
if ad_content:
|
if ad_content:
|
||||||
# Add ad as a separate line/paragraph
|
await self.lolz_api.create_comment(post_id, ad_content)
|
||||||
reply_message = f"{reply_message}\n\n{ad_content}"
|
logger.info(f"Отправлена реклама к посту {post_id}")
|
||||||
logger.info(f"Добавлена реклама к комментарию поста {post_id}")
|
|
||||||
|
|
||||||
await self.lolz_api.create_comment(post_id, reply_message)
|
|
||||||
|
|
||||||
await asyncio.sleep(self.config.api_delay)
|
await asyncio.sleep(self.config.api_delay)
|
||||||
|
|
||||||
if self.notification_bot:
|
if self.notification_bot:
|
||||||
|
|||||||
Reference in New Issue
Block a user