MonkeyBusiness/modules/core/message.py

31 lines
834 B
Python
Raw Normal View History

2022-08-26 12:39:11 +02:00
import config
from fastapi import APIRouter, Request, Response
from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["message"])
2022-11-15 15:03:37 +01:00
@router.post("/{gameinfo}/message/get")
2022-08-26 12:39:11 +02:00
async def message_get(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.message(
expire=300,
2022-11-15 15:03:37 +01:00
*[
E.item(
name=s,
start=0,
end=604800,
)
for s in ("sys.mainte", "sys.eacoin.mainte")
if config.maintenance_mode
]
2022-08-26 12:39:11 +02:00
)
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)