reformat (black)

This commit is contained in:
2025-04-17 14:35:56 -04:00
parent d12b066c8e
commit 1bb482315e
20 changed files with 1928 additions and 1326 deletions

14
api.py
View File

@ -6,6 +6,7 @@ from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import util
class ValidSendMsgRequest(BaseModel):
"""
- **guild**: optional, guild id in case multiple channels match (normally first result would be used)
@ -17,18 +18,19 @@ class ValidSendMsgRequest(BaseModel):
channel: str
message: str
class API:
"""API [FastAPI Instance] for Havoc"""
def __init__(self, discord_bot):
api_app = FastAPI(title="Havoc API")
self.bot = discord_bot
self.api_app = api_app
@api_app.get("/{any:path}")
def block_get():
raise HTTPException(status_code=403, detail="Invalid request")
@api_app.post("/send_msg")
async def send_msg_handler(data: ValidSendMsgRequest):
await util.discord_helpers.send_message(
@ -38,12 +40,14 @@ class API:
message=data.message,
)
return {
'result': "presumed_success",
"result": "presumed_success",
}
def __init__():
import util
importlib.reload(util)
__init__()
__init__()