Fix some TG messages do not arrive

This commit is contained in:
Reckless_Satoshi 2022-03-01 13:34:25 -08:00
parent e6600063ab
commit 8ca497f7b4
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -35,13 +35,13 @@ class Telegram():
message_url = f'https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={chat_id}&text={text}' message_url = f'https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={chat_id}&text={text}'
# telegram messaging is atm inserted dangerously in the logics module # telegram messaging is atm inserted dangerously in the logics module
# if it fails, it should just keep going # if it fails, it should keep trying
try: while True:
self.session.get(message_url).json() try:
except: self.session.get(message_url).json()
pass return
except:
return pass
def welcome(self, user): def welcome(self, user):
lang = user.profile.telegram_lang_code lang = user.profile.telegram_lang_code
@ -151,7 +151,7 @@ class Telegram():
def order_published(self, order): def order_published(self, order):
time.sleep(1) # Just so this message always arrives after the previous two time.sleep(1) # Just so this message always arrives after the previous two
user = order.maker user = order.maker
lang = user.profile.telegram_lang_code lang = user.profile.telegram_lang_code