aboutsummaryrefslogtreecommitdiff
path: root/src/botnet.py
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-07-16 22:43:19 +1200
committerArslaan Pathan <[email protected]>2026-07-16 22:43:19 +1200
commitbc715b12204714dc8046f07387210852026b47b9 (patch)
tree44416a04b5a6699263c18d342404a0ebfdb0beb4 /src/botnet.py
parentd9a6838624e78d90eba962b6004796fbfe1b4b8c (diff)
downloadslack-botnet-bc715b12204714dc8046f07387210852026b47b9.tar.xz
slack-botnet-bc715b12204714dc8046f07387210852026b47b9.zip
Make it send to different channels
Diffstat (limited to 'src/botnet.py')
-rw-r--r--src/botnet.py10
1 files changed, 8 insertions, 2 deletions
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
)