mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Fix no text provided
This commit is contained in:
parent
3906ed73aa
commit
d018aeec0a
@ -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:
|
||||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user