diff options
| author | Arslaan Pathan <[email protected]> | 2026-07-09 17:58:29 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-07-09 17:58:29 +1200 |
| commit | 8dea6c48621b6f933a3a88fbffa4277bda8c00c5 (patch) | |
| tree | cd576333e906dc210da067809033a4ad9c6d2a67 /src/main.py | |
| parent | d9499138aeaf32faee65640e624719df83f465eb (diff) | |
| download | slack-botnet-8dea6c48621b6f933a3a88fbffa4277bda8c00c5.tar.xz slack-botnet-8dea6c48621b6f933a3a88fbffa4277bda8c00c5.zip | |
Botnet deployments work!
:yayayayayay-ctp:
Diffstat (limited to 'src/main.py')
| -rw-r--r-- | src/main.py | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/src/main.py b/src/main.py index 8b0e692..02375cc 100644 --- a/src/main.py +++ b/src/main.py @@ -4,6 +4,7 @@ from slack_bolt.adapter.socket_mode.async_handler import AsyncSocketModeHandler from dotenv import load_dotenv from .db import init_db from .auth import app as fastapi_app +from .botnet import deploy_message import threading import asyncio import uvicorn @@ -18,39 +19,50 @@ app = AsyncApp(token=selfbot_token) @app.message("") async def handle_messages(message, say): - if message.get("channel_type") != "im": - return - - if message.get("user") == selfbot_user_id: - return + try: + if message.get("channel_type") != "im": + return + + if message.get("user") == selfbot_user_id: + return - if message.get("user") != "U0AKCBZHHMH": - await say("Botnet is temporarily disabled for users other than <@U0AKCBZHHMH> for debugging and the safety of all OAuth-authorized users. Please DM <@U0AKCBZHHMH> if this is not resolved within a few days.") - return - - text = message.get("text", "").lower().strip() - - if not text.startswith("botnet"): - # yay more scuffed arbitrary stuff - text = "botnet help" - - parts = text.split(" ") - if len(parts) == 1: - # scuffed as hell, just sets it to help arbitrarily so it gets caught later LMAO - # too bad, if it works dont touch it - parts = ['botnet', 'help'] - - command = parts[1] - args = parts[2:] - - if command == "help": - await say("*Botnet Commands*:\n---\n*botnet help*: shows this message\n*botnet deploy <message>*: sends a message into the deploy queue for review/voting\n*botnet approve <channel>*: approve Botnet to function in a channel (must be CM)", mrkdwn=True) - elif command == "deploy": - await say("Not implemented yet") - elif command == "approve": - await say("Not implemented yet") - else: - await say(f"Unknown command: {command}") + if message.get("user") not in ["U0AKCBZHHMH", "U0BG82V0CP6"]: + await say("Botnet is temporarily disabled for users other than <@U0AKCBZHHMH> for debugging and the safety of all OAuth-authorized users. Please DM <@U0AKCBZHHMH> if this is not resolved within a few days.") + return + + text = message.get("text", "").strip() + + if not text.startswith("botnet"): + # yay more scuffed arbitrary stuff + text = "botnet help" + + parts = text.split(" ") + if len(parts) == 1: + # scuffed as hell, just sets it to help arbitrarily so it gets caught later LMAO + # too bad, if it works dont touch it + parts = ['botnet', 'help'] + + command = parts[1] + args = parts[2:] + + if command == "help": + await say("*Botnet Commands*:\n---\n*botnet help*: shows this message\n*botnet deploy <message>*: sends a message into the deploy queue for review/voting\n*botnet approve <channel>*: approve Botnet to function in a channel (must be CM)", mrkdwn=True) + elif command == "deploy": + if not args: + await say("Please provide a message to deploy!") + return + message_text = " ".join(args) + result = await deploy_message(message.get("user"), message_text) + if result["success"]: + await say(f"^_^ {result['message']} (Deployment #{result['deployment_id']})") + else: + await say(f"T_T {result['error']}") + elif command == "approve": + await say("Not implemented yet") + else: + await say(f"Unknown command: {command}") + except Exception as e: + print(f"something broke, good luck LMAO {e}") @app.event("message") async def shut_up_slack_bolt(): |
