Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/api/exception_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ async def exception_handler(request: Request, exc: Exception, bot: Bot) -> JSONR
)

await bot.send_message(
chat_id=settings.CHAT_ID,
chat_id=settings.ERRORS_CHAT_ID,
message_thread_id=settings.ERRORS_THREAD_ID,
text=error_text,
parse_mode="HTML",
link_preview_options=LinkPreviewOptions(is_disabled=True),
Expand Down
4 changes: 3 additions & 1 deletion app/api/routes/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ async def send_message_handler(
@broadcast_router.post("/error")
async def send_error_handler(
message: Message,
chat_id: int = Query(default=settings.CHAT_ID, alias="id"),
chat_id: int = Query(default=settings.ERRORS_CHAT_ID, alias="id"),
thread_id: Optional[int] = Query(default=settings.ERRORS_THREAD_ID, alias="thread"),
bot: Bot = Depends(BotStub),
) -> JSONResponse:
logging.error(message.text)
Expand Down Expand Up @@ -78,6 +79,7 @@ async def send_error_handler(
error_text = "🚨 <b>Backend Error</b> 🚨\n\n" + error_message + traceback_message
await bot.send_message(
chat_id=chat_id,
message_thread_id=thread_id,
text=error_text,
parse_mode="HTML",
)
Expand Down
2 changes: 2 additions & 0 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Settings(BaseSettings):

TOKEN: SecretStr
CHAT_ID: int
ERRORS_CHAT_ID: int
ERRORS_THREAD_ID: Optional[int] = None
TELEGRAM_SECRET: SecretStr
BASE_URL: AnyUrl = AnyUrl("http://localhost:8000")
FRONT_BASE_URL: AnyUrl
Expand Down
Loading