make catch-up mode to work better (+graceful exit)

This commit is contained in:
muskit
2022-09-28 20:00:02 -07:00
parent d2fc4a4d44
commit 82dbaabd6d
6 changed files with 165 additions and 124 deletions
+7 -1
View File
@@ -67,7 +67,11 @@ class TwAPI:
access_token=api_secrets.access_token(), access_token_secret=api_secrets.access_secret()
)
)
self.me = self.client.get_me().data
try:
self.me = self.client.get_me().data
except Exception as e:
print('Did you setup secrets.ini?')
raise e
print(f'Assuming the account of @{self.me.data["username"]} ({self.me["id"]})')
## ---[COMMENT OUT WHEN NOT IN USE]---
@@ -165,6 +169,8 @@ class TwAPI:
media = self.api.media_upload(img)
return media.media_id
# return True = successfully posted a single ttweet
# return False = did not post ttweet (duplicate)
async def post_ttweet(self, ttweet: tt.TalentTweet, is_catchup=False):
print(f'------{ttweet.tweet_id} ({util.get_username_local(ttweet.author_id)})------')