From 261b0d34df21f42016c8d6bad3034f67a60b45ca Mon Sep 17 00:00:00 2001 From: Administrator Date: Sun, 21 Aug 2022 12:52:06 +0300 Subject: [PATCH] send code --- Main/views/SendCodeView.py | 3 ++- daemons/management/commands/notification_manager.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Main/views/SendCodeView.py b/Main/views/SendCodeView.py index 3a6c3b6..0f2948c 100644 --- a/Main/views/SendCodeView.py +++ b/Main/views/SendCodeView.py @@ -23,7 +23,8 @@ class SendCodeView(BaseView): print(f"Отправлен код для {username}", code) user.userinfo.code = code user.userinfo.save() - send_to_queue("telegram", { + send_to_queue("notification", { + "type": "send_code", "chat_id": user.userinfo.telegram_chat_id, "text": "Код для входа в сервис: " + str(code) }) diff --git a/daemons/management/commands/notification_manager.py b/daemons/management/commands/notification_manager.py index d6b91f1..b7c332e 100644 --- a/daemons/management/commands/notification_manager.py +++ b/daemons/management/commands/notification_manager.py @@ -31,6 +31,9 @@ class Command(MessagingSupport): parse_mode="html", ) + def handle_send_code(self, payload): + yield "telegram", payload + def handle_solution(self, payload): solution = Solution.objects.get(id=payload["solution_id"]) user = solution.user