Skip to content

Commit

Permalink
Notify coordinator admin for new disputes (#1204)
Browse files Browse the repository at this point in the history
notify coordinator admin for new disputes
  • Loading branch information
KoalaSat authored Mar 28, 2024
1 parent 6a8b381 commit 22a93d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions api/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ def dispute_opened(self, order):
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):
Expand Down

0 comments on commit 22a93d6

Please sign in to comment.