This is an implementation to join the Twitter and the Telegram APIs using Python 3.9
The bot sends to Telegram tweets in realtime from the users registered on the database.
After cloning the repository, create a Python virtual environment, to don't mix with other libraries versions
python -m venv venv
Now activate the virtual environment:
source venv/bin/activate
And install the required packages:
pip install -r requirements.txt
Go to the settings folder and fill a .env
file with your Twitter Standard v1.1 and Telegram Bot keys following the .env_example
file. On the first start of the bot, he will send your chat id on the message, to put on the .env
file.
The database will be created by running the bot and adding the first username.
To start the bot:
python bot.py
To start receiving tweets, send /startstream
to the bot.
This bot has the following limitations
- Even if you have access to an account with protected tweets (called status by the API), you can't receive them, since the API only returns public status as shown here
Returns public statuses that match one or more filter predicates.
- The stream doesn't restart automatically if your stream suffers a disconnection. More about how to implement it here
- After inserting a new user into the database, you'll need to manually stop the stream and start it again to receive this account tweets.
This bot uses: