Skip to content

Commit

Permalink
sleep method added
Browse files Browse the repository at this point in the history
  • Loading branch information
UngeheurenUngeziefer authored Jun 23, 2020
1 parent d9be667 commit e94dc67
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Telegram_poster.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ def img_path(message):
addresses_list.append(path + '/' + img) # addresses list contain ['address_1', 'address_N' ...]
for path in addresses_list:
# return path # return addresses like: './downloads/pepe_10.png'
try:
PosterBot.sendPhoto(chat_id, photo=open(path, 'rb'))
print('Posting {}'.format(path))
except telepot.exception.TooManyRequestsError:
print('Too Many Requests')
continue
PosterBot.sendPhoto(chat_id, photo=open(path, 'rb'))
print('Posting {}'.format(path))
sleep(3) # sleep for 3 sec - telegram limit 20 per minute

MessageLoop(PosterBot, img_path).run_as_thread()
print('Listening ...')
Expand Down

0 comments on commit e94dc67

Please sign in to comment.