Skip to content

Commit 6d17fa2

Browse files
committed
refactor: remove twikit implementation
1 parent 0dc8fd4 commit 6d17fa2

File tree

4 files changed

+1
-371
lines changed

4 files changed

+1
-371
lines changed

cogs/autopost.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
from typing import TYPE_CHECKING
44

5-
import asyncio
65
from datetime import UTC, time, datetime
76

8-
import twikit
97
import aiohttp
108
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
119
from telegram.error import TelegramError
@@ -64,24 +62,7 @@ async def _autopost_vote_reminder(self):
6462
embed.description += "\n"
6563

6664
else:
67-
try:
68-
async with asyncio.timeout(60):
69-
client = twikit.Client("en-US")
70-
71-
await client.login(
72-
auth_info_1=self.bot.config.TWITTER_USERNAME,
73-
auth_info_2=self.bot.config.TWITTER_EMAIL,
74-
password=self.bot.config.TWITTER_PASSWORD,
75-
cookies_file="cookies.json",
76-
)
77-
78-
user = await client.get_user_by_screen_name("NervaCurrency")
79-
tweets = await client.get_user_tweets(user.id, "Tweets", count=1)
80-
81-
post_id = tweets[0].id
82-
83-
except (TimeoutError, twikit.TwitterException):
84-
post_id = self.bot.config.FALLBACK_TWEET_ID
65+
post_id = self.bot.config.FALLBACK_TWEET_ID
8566

8667
embed.description = (
8768
f"Interact on X:\n\nhttps://x.com/NervaCurrency/status/{post_id}\n\n"

config.example.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828

2929
GITHUB_TOKEN = "..."
3030

31-
TWITTER_USERNAME = "..."
32-
TWITTER_EMAIL = "..."
33-
TWITTER_PASSWORD = "..."
34-
3531
FALLBACK_TWEET_ID = ...
3632

3733
AUTOPOST_VOTE_REMINDER_CHANNEL_ID = ...

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ dependencies = [
1717
"motor>=3.6.0",
1818
"python-dateutil>=2.9.0.post0",
1919
"python-telegram-bot>=21.6",
20-
"twikit>=2.3.3",
2120
"validators>=0.34.0",
2221
]
2322

0 commit comments

Comments
 (0)