1818from tournesol .models .poll import DEFAULT_POLL_NAME , Poll
1919from tournesol .utils .contributors import get_top_public_contributors_last_month
2020from twitterbot import settings
21- from twitterbot .models .tweeted import TweetInfo
22- from twitterbot .twitter_api import TwitterBot
21+ from twitterbot .models .history import TweetInfo
22+ from twitterbot .client import TournesolBotClient
2323from twitterbot .uploader_twitter_account import get_twitter_account_from_video_id
2424
2525
@@ -176,9 +176,9 @@ def tweet_video_recommendation(bot_name, dest: list[str], assumeyes=False):
176176 Accepted values are "twitter" and "bluesky".
177177 """
178178
179- twitterbot = TwitterBot (bot_name )
179+ bot_client = TournesolBotClient (bot_name )
180180
181- tweetable_videos = get_video_recommendations (language = twitterbot .language )
181+ tweetable_videos = get_video_recommendations (language = bot_client .language )
182182 if not tweetable_videos :
183183 print ("No video reach the criteria to be tweeted today!!!" )
184184 return
@@ -198,11 +198,11 @@ def tweet_video_recommendation(bot_name, dest: list[str], assumeyes=False):
198198 # Tweet the video
199199 if "twitter" in dest :
200200 tweet_text = prepare_text (video , dest = "twitter" )
201- tweet_id = twitterbot .create_tweet (text = tweet_text )
201+ tweet_id = bot_client .create_tweet (text = tweet_text )
202202
203203 if "bluesky" in dest :
204204 text = prepare_text (video , dest = "bluesky" )
205- atproto_uri = twitterbot .create_bluesky_post (text = text , embed_video = video )
205+ atproto_uri = bot_client .create_bluesky_post (text = text , embed_video = video )
206206
207207 # Add the video to the TweetInfo table
208208 tweet_info : TweetInfo = TweetInfo .objects .create (
@@ -280,8 +280,8 @@ def tweet_top_contributor_graph(bot_name, dest: list[str], assumeyes=False):
280280
281281 """
282282
283- twitterbot = TwitterBot (bot_name )
284- language = twitterbot .language
283+ bot_client = TournesolBotClient (bot_name )
284+ language = bot_client .language
285285
286286 top_contributors_qs = get_top_public_contributors_last_month (
287287 poll_name = DEFAULT_POLL_NAME , top = 10
@@ -302,20 +302,20 @@ def tweet_top_contributor_graph(bot_name, dest: list[str], assumeyes=False):
302302
303303 message_url = None
304304 if "twitter" in dest :
305- tweet_id = twitterbot .create_tweet (
305+ tweet_id = bot_client .create_tweet (
306306 text = settings .top_contrib_tweet_text_template [language ],
307307 media_files = [top_contributor_figure ]
308308 )
309309 message_url = f"https://twitter.com/{ bot_name } /status/{ tweet_id } "
310310
311311 if "bluesky" in dest :
312- post_uri = twitterbot .create_bluesky_post (
312+ post_uri = bot_client .create_bluesky_post (
313313 text = settings .top_contrib_tweet_text_template [language ],
314314 image_files = [top_contributor_figure ],
315315 image_alts = [settings .top_contrib_tweet_image_alt [language ]]
316316 )
317317 post_id = post_uri .rsplit ("/" , 1 )[- 1 ]
318- message_url = f'https://bsky.app/profile/{ twitterbot .bluesky_handle } /post/{ post_id } '
318+ message_url = f'https://bsky.app/profile/{ bot_client .bluesky_handle } /post/{ post_id } '
319319
320320 if message_url is not None :
321321 # Post the tweet on Discord
0 commit comments