A Discord bot that posts RSS feed updates of a Twitter user to a specified channel. The bot utilizes Nitter instances (Twitter front-ends focused on privacy) to fetch the RSS feed and send new tweets to the configured Discord channels.
- Fetch tweets from a specified Twitter account using RSS feeds from multiple Nitter instances
- Post new tweets to configured Discord channels
- Command to add or remove channels for receiving tweets
- Command to start, pause, restart, or force sending tweets
- Command to retrieve specific or all recent tweets
- Persistent storage of sent tweets using Firebase Realtime Database
- Customizable interval for checking for new tweets
- The bot relies on the availability and reliability of Nitter instances, which may vary.
- The bot does not handle rate limiting or other potential issues that may arise from frequent requests to Nitter instances(there are multiple instances by default so it is not really a problem).
- The bot does not support direct Twitter integration and relies solely on RSS feeds provided by Nitter instances (Thanks to Elon Musk).
- Python 3.9+ (I haven't tested on previous 3. versions but it should work)
- Python modules listed in
requirements.txt
- Discord bot token
- Firebase Realtime Database project with a service account key
- The bot fetches the RSS feed of the specified Twitter account from multiple Nitter instances.
- It compares the fetched tweets with the previously sent tweets stored in the Firebase Realtime Database.
- New tweets are formatted and sent to the configured Discord channels.
- The sent tweets are stored in the Firebase Realtime Database to avoid duplicates.
- The process repeats at a specified interval.
- Set up a Discord bot and obtain its token.
- Create a Firebase Realtime Database project and download the service account key
ServiceAccount.json
. - Create a
.env
file with the required configuration variables (see the .env.example file). - Install the required Python modules:
pip install -r requirements.txt
- Run the bot:
python main.py
- Use the following commands in your Discord server (
!
is the prefix by default or you can use slash commands/
):!ping
: Test the bot's responsiveness.!addchannel <channel_mention>
: Add a channel to receive tweets.!removechannel <channel_id>
: Remove a channel from receiving tweets.!startrss
: Start the task of fetching and sending tweets.!pauserss
: Pause the tweet fetching and sending task.!restartrss
: Restart the tweet fetching and sending task.!getrss <range>
: Retrieve specific tweets (e.g.,!getrss 0-5
or!getrss 3
).!getallrss
: Retrieve all recent tweets.!forcesend
: Force the bot to send tweets immediately.
The bot must have the following permissions:
- Send Messages
- Read Message History
Released under MIT. See LICENSE
for details.