From 22a93d630ddab3118493c375591327e637d43908 Mon Sep 17 00:00:00 2001 From: KoalaSat Date: Thu, 28 Mar 2024 02:23:24 +0100 Subject: [PATCH] Notify coordinator admin for new disputes (#1204) notify coordinator admin for new disputes --- .env-sample | 2 ++ api/notifications.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/.env-sample b/.env-sample index 7a1f48ab..cfb09671 100644 --- a/.env-sample +++ b/.env-sample @@ -65,6 +65,8 @@ ALTERNATIVE_NAME = 'RoboSats Mainnet' # Telegram bot token TELEGRAM_TOKEN = '' TELEGRAM_BOT_NAME = 'RoboCoordinatorNotificationBot' +# Telegram chat id to receive admin notifications +TELEGRAM_COORDINATOR_CHAT_ID = 'AdminNotificationChatId' # Notify new messages in-chat app (fiat exchange step) if at least X minutes has passed since the last chat message. CHAT_NOTIFICATION_TIMEGAP = 5 diff --git a/api/notifications.py b/api/notifications.py index c1bd1f46..67416266 100644 --- a/api/notifications.py +++ b/api/notifications.py @@ -138,6 +138,15 @@ class Telegram: else: text = f"⚖️ Hey {user.username}, a dispute has been opened on your order with ID {str(order.id)}." self.send_message(user.robot.telegram_chat_id, text) + + admin_chat_id = config("TELEGRAM_ADMIN_CHAT_ID") + + if len(admin_chat_id) == 0: + return + + coordinator_text = f"There is a new dispute opened for the order with ID {str(order.id)}. Visit http://{self.site}/coordinator/api/order/{str(order.id)}/change to proceed." + self.send_message(admin_chat_id, coordinator_text) + return def order_published(self, order):