Fix telegram bot

This commit is contained in:
koalasat 2024-07-18 01:34:34 +02:00
parent 886956c5a9
commit fd1f82f2f5
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157

View File

@ -50,16 +50,16 @@ class Command(BaseCommand):
parts = message.split(" ") parts = message.split(" ")
if len(parts) < 2: if len(parts) < 2:
self.notifications.send_telegram_message( self.notifications.send_telegram_message(
chat_id=result["message"]["from"]["id"], result["message"]["from"]["id"],
text='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.', '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 continue
token = parts[-1] token = parts[-1]
robot = Robot.objects.filter(telegram_token=token).first() robot = Robot.objects.filter(telegram_token=token).first()
if not robot: if not robot:
self.notifications.send_telegram_message( self.notifications.send_telegram_message(
chat_id=result["message"]["from"]["id"], result["message"]["from"]["id"],
text=f'Wops, invalid token! There is no Robot with telegram chat token "{token}"', f'Wops, invalid token! There is no Robot with telegram chat token "{token}"',
) )
continue continue