Fix no text provided

This commit is contained in:
Reckless_Satoshi 2022-02-21 17:50:32 -08:00
parent 3906ed73aa
commit d018aeec0a
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 6 additions and 9 deletions

View File

@ -27,7 +27,6 @@ class Command(BaseCommand):
time.sleep(self.rest) time.sleep(self.rest)
params = {'offset' : offset + 1 , 'timeout' : 5} params = {'offset' : offset + 1 , 'timeout' : 5}
print(params)
response = self.session.get(self.updates_url, params=params).json() response = self.session.get(self.updates_url, params=params).json()
if len(list(response['result'])) == 0: if len(list(response['result'])) == 0:
continue continue
@ -36,7 +35,6 @@ class Command(BaseCommand):
splitted_text = text.split(' ') splitted_text = text.split(' ')
if splitted_text[0] == '/start': if splitted_text[0] == '/start':
token = splitted_text[-1] token = splitted_text[-1]
print(token)
try : try :
profile = Profile.objects.get(telegram_token=token) profile = Profile.objects.get(telegram_token=token)
except: except:

View File

@ -38,8 +38,7 @@ class Telegram():
return return
@classmethod def welcome(self, user):
def welcome(cls, user):
lang = user.profile.telegram_lang_code lang = user.profile.telegram_lang_code
order = Order.objects.get(maker=user) order = Order.objects.get(maker=user)
print(str(order.id)) print(str(order.id))
@ -47,11 +46,11 @@ class Telegram():
text = f'Hola ⚡{user.username}⚡, Te enviaré un mensaje cuando tu orden con ID {str(order.id)} haya sido tomada.' text = f'Hola ⚡{user.username}⚡, Te enviaré un mensaje cuando tu orden con ID {str(order.id)} haya sido tomada.'
else: else:
text = f"Hey ⚡{user.username}⚡, I will send you a message when someone takes your order with ID {str(order.id)}." text = f"Hey ⚡{user.username}⚡, I will send you a message when someone takes your order with ID {str(order.id)}."
cls.send_message(user, text) self.send_message(user=user, text=text)
return return
@classmethod
def order_taken(cls, order): def order_taken(self, order):
user = order.maker user = order.maker
if not user.profile.telegram_enabled: if not user.profile.telegram_enabled:
return return
@ -64,5 +63,5 @@ class Telegram():
else: 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.' text = f'Your order with ID {order.id} was taken by {taker_nick}!🥳 Visit http://{site}/order/{order.id} to proceed with the trade.'
cls.send_message(user, text) self.send_message(user=user, text=text)
return return