Automate your Twitter presence. Auto Post tweets from from openAI GPT4, from a file, from a string, schedule a new tweet to be posted daily or post the tweet instantly.
This Python-based Twitter Auto-Post Bot automates tweeting, Credit to the Tweepy library for making this easy, this project enables scheduled and random tweets, offering a dynamic and engaging Twitter experience.
-
src/instantly-tweet-from-openai.py
: Immediately tweets a tweet from openAI api response, currently using GPT4, but you can change the model in functions.py -
Prompt defined here
src/schedule-daily-post-from-openai.py
: Automates daily tweets, Runs daily at a scheduled time and queries open ai api to create a tweet, the tweet returned is then automatically tweeted each day to fully automate twitter on auto pilot. By default the model is OPENAI GPT4 but you can change the model in functions.py.-
Prompt defined here
-
Schedule time defined here
src/schedule-daily-post-from-file.py
: Automates daily tweets, randomly selecting fromtweets.txt
. To change the schedule time edit this.src/tweeter-random-from-file.py
: Instantly posts a random tweet fromtweets.txt
.
src/tweeter-from-code.py
: Immediately tweets a pre-defined message with the current date, but you can change this to whatever you like.
config/keys.py
: Holds both the creds for openai and twitter api.src/functions.py
: Shared functions for generating tweets from openai and tweet postingrequirements.txt
: Lists all necessary Python packages.
Adding CLI
.
- Python 3.x
- Tweepy (Twitter API)
- Clone the repo:
git clone [email protected]:lewispour/Twitter-auto-Post-Bot---X.com---Tweepy-python-bot.git
- Install Python packages:
pip install -r requirements.txt
- Obtain Twitter API credentials here.
- update
config/keys.py
file with your credentials:bearer_token = "GET_KEY_FROM_developer.twitter.com/apps" api_key = "GET_KEY_FROM_developer.twitter.com/apps" api_secret = "GET_KEY_FROM_developer.twitter.com/apps" access_token = "GET_KEY_FROM_developer.twitter.com/apps" access_token_secret = "GET_KEY_FROM_developer.twitter.com/apps" openai_key = "GET_YOUR_OPENAI_API_KEY_FROM_https://platform.openai.com/api-keys"
- Customize
data/tweets.txt
with your tweets. (SKIP: If not using tweet from file)
Run any script using Python:
cd src/
python instantly-tweet-from-openai.py
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
Distributed under the MIT License. See LICENSE
for more information.
Project Link: https://github.com/lewispour/Twitter-auto-Post-Bot---X.com---Tweepy-python-bot
- Last tested and still working on 10/06/2024 ✅