Commit fb77e3a2 authored by Niklas Ulfvarson's avatar Niklas Ulfvarson
Browse files

Increased delay to make Telegram happier

parent a73d0e06
......@@ -48,13 +48,16 @@ if post_date != last_date:
lst_split = re.findall(r'(?s)(<strong>.*?)(?=<strong>)', lst)
msg_str = "Nya rymdjobb " + post_date + "! 🚀\n"
data = {'chat_id': '@Rymdjobb', 'disable_notification': 'True', 'text': msg_str}
r = requests.post(turl, data).json()
time.sleep(3)
## Send all the listings!
for i in range(0, len(lst_split)):
lst_msg = lst_split[i]
data = {'chat_id': '@Rymdjobb', 'disable_web_page_preview': 'True', 'disable_notification': 'True', 'parse_mode': 'html', 'text': lst_msg}
r = requests.post(turl, data).json()
time.sleep(1)
time.sleep(3)
if not r['ok']:
print('Message failed! Response: ' + str(r))
......
  • Telegram only allows 20 messages per minute, so a delay of 3 seconds is necessary to comply when the amount of companies > 20.

    The negative side is that it takes over a minute for all messages to show, but if that's what it takes then so be it.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment