Add inline error info

This commit is contained in:
BarsTiger
2023-10-31 13:50:50 +02:00
parent aab1bdf77a
commit a16e508a55
8 changed files with 71 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
from aiogram.types import (
InlineQueryResultArticle, InputTextMessageContent,
)
from bot.modules.database import db
from bot.modules.error import Error
from bot.common import console
async def get_error_search_results(error_id: str) -> (list[InlineQueryResultArticle]
| None):
error: Error = db.errors.get(error_id)
if error is None:
return []
console.print(f'{error_id} requested')
console.print(error.traceback)
console.print(f'-{error_id} requested-')
return [(
InlineQueryResultArticle(
id=error_id,
title=f'Error {error_id}',
description=error.exception.short,
input_message_content=InputTextMessageContent(
message_text=error.exception.long,
parse_mode='HTML',
),
)
)]