mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Fixes for telegra messaing errors in production
This commit is contained in:
parent
d018aeec0a
commit
b9b71dc842
@ -30,7 +30,7 @@ FIAT_EXCHANGE_DURATION = int(config("FIAT_EXCHANGE_DURATION"))
|
||||
|
||||
|
||||
class Logics:
|
||||
|
||||
telegram = Telegram()
|
||||
@classmethod
|
||||
def validate_already_maker_or_taker(cls, user):
|
||||
"""Validates if a use is already not part of an active order"""
|
||||
@ -129,7 +129,7 @@ class Logics:
|
||||
order.expires_at = timezone.now() + timedelta(
|
||||
seconds=Order.t_to_expire[Order.Status.TAK])
|
||||
order.save()
|
||||
Telegram.order_taken(order)
|
||||
cls.telegram.order_taken(order)
|
||||
return True, None
|
||||
|
||||
def is_buyer(order, user):
|
||||
|
@ -16,7 +16,7 @@ class Command(BaseCommand):
|
||||
updates_url = f'https://api.telegram.org/bot{bot_token}/getUpdates'
|
||||
|
||||
session = get_tor_session()
|
||||
|
||||
telegram = Telegram()
|
||||
def handle(self, *args, **options):
|
||||
"""Infinite loop to check for telegram updates.
|
||||
If it finds a new user (/start), enables it's taker found
|
||||
@ -42,7 +42,7 @@ class Command(BaseCommand):
|
||||
continue
|
||||
profile.telegram_chat_id = result['message']['from']['id']
|
||||
profile.telegram_lang_code = result['message']['from']['language_code']
|
||||
Telegram.welcome(profile.user)
|
||||
self.telegram.welcome(profile.user)
|
||||
profile.telegram_enabled = True
|
||||
profile.save()
|
||||
|
||||
|
@ -46,7 +46,7 @@ class Telegram():
|
||||
text = f'Hola ⚡{user.username}⚡, Te enviaré un mensaje cuando tu orden con ID {str(order.id)} haya sido tomada.'
|
||||
else:
|
||||
text = f"Hey ⚡{user.username}⚡, I will send you a message when someone takes your order with ID {str(order.id)}."
|
||||
self.send_message(user=user, text=text)
|
||||
self.send_message(user, text)
|
||||
return
|
||||
|
||||
|
||||
@ -63,5 +63,5 @@ class Telegram():
|
||||
else:
|
||||
text = f'Your order with ID {order.id} was taken by {taker_nick}!🥳 Visit http://{site}/order/{order.id} to proceed with the trade.'
|
||||
|
||||
self.send_message(user=user, text=text)
|
||||
self.send_message(user, text)
|
||||
return
|
Loading…
Reference in New Issue
Block a user