Fixes for telegra messaing errors in production

This commit is contained in:
Reckless_Satoshi 2022-02-21 18:12:42 -08:00
parent d018aeec0a
commit b9b71dc842
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 6 additions and 6 deletions

View File

@ -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):

View File

@ -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()

View File

@ -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