Skip to content

Commit 67454dd

Browse files
committed
rename some files and classes mentionning twitter
1 parent c22783a commit 67454dd

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

backend/twitterbot/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django.contrib import admin
99
from django.utils.html import format_html
1010

11-
from .models.tweeted import TweetInfo
11+
from .models.history import TweetInfo
1212

1313

1414
@admin.register(TweetInfo)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tournesol.models import Entity
99

1010

11-
class TwitterBot:
11+
class TournesolBotClient:
1212
def __init__(self, account):
1313

1414
credentials = settings.TWITTERBOT_CREDENTIALS

backend/twitterbot/management/commands/load_tweetinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from tournesol.entities.video import YOUTUBE_UID_NAMESPACE
66
from tournesol.models.entity import Entity
7-
from twitterbot.models.tweeted import TweetInfo
7+
from twitterbot.models.history import TweetInfo
88

99

1010
class Command(BaseCommand):

backend/twitterbot/tournesolbot.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
from tournesol.models.poll import DEFAULT_POLL_NAME, Poll
1919
from tournesol.utils.contributors import get_top_public_contributors_last_month
2020
from 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
2323
from 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

backend/twitterbot/views/__init__.py

Whitespace-only changes.

infra/ansible/scripts/forget-secrets.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ unset DISCORD_INFRA_ALERT_PRIVATE_WEBHOOK
3131
unset DISCORD_TWITTER_WEBHOOK
3232
unset PLAUSIBLE_ANALYTICS_SECRET_KEY
3333
unset ATPROTO_PASSWORD_BOT_FR
34-
unset ATPROTO_PASSWORD_BOT_EN
34+
unset ATPROTO_PASSWORD_BOT_EN

infra/ansible/scripts/get-vm-secrets.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ ATPROTO_PASSWORD_BOT_FR=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@Tourneso
104104
export ATPROTO_PASSWORD_BOT_FR
105105

106106
ATPROTO_PASSWORD_BOT_EN=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@TournesolBot\".ATPROTO_PASSWORD)
107-
export ATPROTO_PASSWORD_BOT_EN
107+
export ATPROTO_PASSWORD_BOT_EN

0 commit comments

Comments
 (0)