diff options
Diffstat (limited to 'src/main.py')
| -rw-r--r-- | src/main.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main.py b/src/main.py index 6f5e2d6..8b0e692 100644 --- a/src/main.py +++ b/src/main.py @@ -2,7 +2,11 @@ import os from slack_bolt.app.async_app import AsyncApp 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 +import threading import asyncio +import uvicorn load_dotenv() @@ -19,11 +23,16 @@ async def handle_messages(message, say): 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"): - return + # yay more scuffed arbitrary stuff + text = "botnet help" parts = text.split(" ") if len(parts) == 1: @@ -41,7 +50,7 @@ async def handle_messages(message, say): elif command == "approve": await say("Not implemented yet") else: - await say("Unknown command: {command}") + await say(f"Unknown command: {command}") @app.event("message") async def shut_up_slack_bolt(): @@ -49,6 +58,14 @@ async def shut_up_slack_bolt(): pass async def main(): + await init_db() + + def run_uvicorn(): + uvicorn.run(fastapi_app, host="0.0.0.0", port=8000) + + thread = threading.Thread(target=run_uvicorn, daemon=True) + thread.start() + handler = AsyncSocketModeHandler(app, app_token=app_token) await handler.start_async() |
