save last_id more often

This commit is contained in:
2019-02-04 12:15:53 +03:00
parent 0c0e63f545
commit c1679c52a9
8 changed files with 15 additions and 12 deletions

View File

@@ -17,5 +17,4 @@ class WPComicFeedModuleConfig(FeedModuleConfig):
media = requests.get('{}/wp-json/wp/v2/media'.format(self.domain.rstrip('/'))).json()
for m in filter(lambda x: x['id'] > last_id, reversed(media)):
bot.send_photo(chat_id, photo=m['source_url'], caption=m['title']['rendered'])
last_id = m['id']
return last_id
yield m['id']