minor reformatting

This commit is contained in:
muskit
2023-01-14 02:20:21 -08:00
parent b311cc0014
commit c14661af97
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -10,18 +10,23 @@ from twapi import TwAPI
import ttweetqueue as ttq import ttweetqueue as ttq
import api_secrets import api_secrets
import talent_lists as tl import talent_lists as tl
import util
errors_encountered = 0 errors_encountered = 0
def on_response(resp): def on_response(resp):
ttweet = TalentTweet.create_from_v2api_response(resp) ttweet = TalentTweet.create_from_v2api_response(resp)
tweet_username = util.get_username(ttweet.author_id)
if ttweet.is_cross_company(): if ttweet.is_cross_company():
print(f'Tweet {ttweet.tweet_id} is cross-company! Creating post...') print(f'Tweet {ttweet.tweet_id} is cross-company! Creating post...')
asyncio.run(TwAPI.instance.post_ttweet(ttweet)) is_successful = asyncio.run(TwAPI.instance.post_ttweet(ttweet))
ttq.TalentTweetQueue.instance.add_finished_tweet(ttweet.tweet_id) if is_successful:
ttq.TalentTweetQueue.instance.add_finished_tweet(ttweet.tweet_id)
else:
print(f'[WARNING] Failed to post ttweet for {tweet_username}/{ttweet.tweet_id}!')
else: else:
print(f'Tweet {ttweet.tweet_id} is not cross-company.') print(f'Tweet {tweet_username}/{ttweet.tweet_id} is not cross-company.')
def run(): def run():
global errors_encountered global errors_encountered
+1 -1
View File
@@ -237,7 +237,7 @@ class TwAPI:
if dry_run: print('-------------------- DRY RUN --------------------') if dry_run: print('-------------------- DRY RUN --------------------')
print(text) print(text)
if dry_run: return if dry_run: return False
# NO DRY-RUN: actually post tweet # NO DRY-RUN: actually post tweet
# main tweet: text + screenshot # main tweet: text + screenshot