added more save_last(), schadet nicht

This commit is contained in:
b3yond 2018-01-18 20:15:41 +01:00
parent 38f7e31d6c
commit 0dc17d65f0

View file

@ -141,6 +141,7 @@ class RetweetBot(object):
logger.info("Retweeted: " + status.format()) logger.info("Retweeted: " + status.format())
if status.id > self.last_mention: if status.id > self.last_mention:
self.last_mention = status.id self.last_mention = status.id
self.save_last()
return status.format() return status.format()
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
logger.error("Twitter API Error: Bad Connection", exc_info=True) logger.error("Twitter API Error: Bad Connection", exc_info=True)
@ -150,6 +151,7 @@ class RetweetBot(object):
logger.error("Twitter Error", exc_info=True) logger.error("Twitter Error", exc_info=True)
if status.id > self.last_mention: if status.id > self.last_mention:
self.last_mention = status.id self.last_mention = status.id
self.save_last()
return None return None
def post(self, status): def post(self, status):
@ -194,10 +196,6 @@ class RetweetBot(object):
if toot: if toot:
all_tweets.append(toot) all_tweets.append(toot)
# save the id so it doesn't get crawled again
if status.id > self.last_mention:
self.last_mention = status.id
self.save_last()
# Return Retweets for posting on other bots # Return Retweets for posting on other bots
return all_tweets return all_tweets