save last_id more often
This commit is contained in:
@@ -15,3 +15,4 @@ class DankMemesFeedModuleConfig(FeedModuleConfig):
|
||||
p = p['data']
|
||||
bot.send_photo(chat_id, p['url'])
|
||||
break
|
||||
yield None
|
||||
|
@@ -11,3 +11,4 @@ class EchoFeedModuleConfig(FeedModuleConfig):
|
||||
|
||||
def execute(self, bot: TeleBot, chat_id, last_id):
|
||||
bot.send_message(chat_id, self.message)
|
||||
yield None
|
||||
|
@@ -20,5 +20,4 @@ class ShittyWatercolourFeedModuleConfig(FeedModuleConfig):
|
||||
p['data']['post_hint'] == 'image':
|
||||
p = p['data']
|
||||
bot.send_photo(chat_id, p['url'], p['title'])
|
||||
last_id = p['created']
|
||||
return last_id
|
||||
yield p['created']
|
||||
|
@@ -76,5 +76,4 @@ class VKFeedModuleConfig(FeedModuleConfig):
|
||||
disable_web_page_preview=True)
|
||||
except Exception as e:
|
||||
sentry_sdk.capture_exception(e)
|
||||
last_id = post['id']
|
||||
return last_id
|
||||
yield post['id']
|
||||
|
@@ -66,5 +66,4 @@ class VKMusicFeedModuleConfig(FeedModuleConfig):
|
||||
f = get_file(track['url'], vk_session.http)
|
||||
bot.send_audio(chat_id, f, duration=track['duration'], performer=track['artist'],
|
||||
title=track['title'])
|
||||
last_id = track['id']
|
||||
return last_id
|
||||
yield track['id']
|
||||
|
@@ -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']
|
||||
|
Reference in New Issue
Block a user