Skip to content

Commit

Permalink
Fix telegram bot
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaSat committed Jul 18, 2024
1 parent fbfa7a0 commit 70fc02b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions api/management/commands/telegram_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def handle(self, *args, **options):
self.notifications.send_telegram_message(
result["message"]["from"]["id"],
'You must enable the notifications bot using the RoboSats client. Click on your "Robot robot" -> "Enable Telegram" and follow the link or scan the QR code.',
"",
)
continue
token = parts[-1]
Expand All @@ -61,7 +60,6 @@ def handle(self, *args, **options):
self.notifications.send_telegram_message(
result["message"]["from"]["id"],
f'Wops, invalid token! There is no Robot with telegram chat token "{token}"',
"",
)
continue

Expand Down
4 changes: 2 additions & 2 deletions api/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def send_message(self, order, robot, title, description=""):
if robot.telegram_enabled:
self.send_telegram_message(robot.telegram_chat_id, title, description)

def save_message(self, order, robot, title, description):
def save_message(self, order, robot, title, description=""):
"""Save a message for a user"""
Notification.objects.create(
title=title, description=description, robot=robot, order=order
)

def send_telegram_message(self, chat_id, title, description):
def send_telegram_message(self, chat_id, title, description=""):
"""sends a message to a user with telegram notifications enabled"""

bot_token = config("TELEGRAM_TOKEN")
Expand Down

0 comments on commit 70fc02b

Please sign in to comment.