diff --git a/bot/handlers/command_graph.py b/bot/handlers/command_graph.py index f5a7112..5b6809f 100644 --- a/bot/handlers/command_graph.py +++ b/bot/handlers/command_graph.py @@ -3,6 +3,9 @@ from api import send_document from storage import storage, scan import json +import logging +logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.INFO) async def handle_command_graph(msg): _usr_ids, members = scan(match="usr-*", count=100) diff --git a/bot/handlers/handle_feedback.py b/bot/handlers/handle_feedback.py index 5ffe4e2..736173c 100644 --- a/bot/handlers/handle_feedback.py +++ b/bot/handlers/handle_feedback.py @@ -41,6 +41,8 @@ async def handle_feedback(msg, state): async def handle_answer(msg): answered_msg = msg["reply_to_message"] + if "from" not in answered_msg: + answered_msg["from"] = vars(msg.from_user) r = await get_chat_administrators(msg["chat"]["id"]) logger.debug(r) admins = [] diff --git a/bot/handlers/routing.py b/bot/handlers/routing.py index 8eee954..644db74 100644 --- a/bot/handlers/routing.py +++ b/bot/handlers/routing.py @@ -16,10 +16,14 @@ async def handle_routing(msg, state): if cid == uid: # сообщения в личке с ботом logger.info("private chat message") - if msg["text"].startswith("/my"): - await handle_command_my(msg, state) - else: - await handle_feedback(msg, state) + if "text" in msg: + text = msg["text"] + if text.startswith("/my"): + await handle_command_my(msg, state) + elif text.startswith("/graph"): + await handle_command_graph(msg) + else: + await handle_feedback(msg, state) elif str(cid) == FEEDBACK_CHAT_ID: # сообщения из группы обратной связи