From bc715b12204714dc8046f07387210852026b47b9 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Thu, 16 Jul 2026 22:43:19 +1200 Subject: Make it send to different channels --- src/botnet.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/botnet.py') diff --git a/src/botnet.py b/src/botnet.py index 377c0c2..225f7e9 100644 --- a/src/botnet.py +++ b/src/botnet.py @@ -1,5 +1,5 @@ from .db import create_deployment, get_daily_user_deployment_count, get_deployment, update_deployment_status, get_active_users, get_user, add_deployment_message, get_deployment_messages -from .utils import generate_voting_blocks +from .utils import generate_voting_blocks, get_random_channel from slack_sdk.web.async_client import AsyncWebClient import os from dotenv import load_dotenv @@ -122,8 +122,14 @@ async def execute_deployment(deployment_id: int): for user in users: try: client = AsyncWebClient(token=user["oauth_token"]) + channel = await get_random_channel(user["oauth_token"]) + if not channel: + print(f"No channels found for {user['slack_id']}, using #botnet") + channel_id = "C0BGMV1CAQG" + else: + channel_id = channel["id"] response = await client.chat_postMessage( - channel="C0BGMV1CAQG", # put it in #botnet for now, make it detect recent thread with CM approval yada yada later + channel=channel_id, # put it in #botnet for now, make it detect recent thread with CM approval yada yada later text=message, as_user=True ) -- cgit v1.2.3