This is a Twitter bot project that generates and posts random theme poems to the Twitter account @momo123us. The bot uses the Twitter API and OpenAI's text generation model to create poems and automatically post them on Twitter.
Before running the project, make sure you have the following:
- Python 3.x installed
- Twitter API credentials
- OpenAI API key
- AWS S3 bucket configured
- AWS DynamoDB client
- Clone the repository:
git clone https://github.com/your-username/your-repo.git
- Install the required dependencies by running the following command:
pip install -r requirements.txt
- Create a
.env
file in the project root directory and populate it with your environment variables:
S3_BUCKET_NAME=your-bucket-name
BEARER_TOKEN=your-twitter-bearer-token
API_KEY=your-twitter-api-key
API_KEY_SECRET=your-twitter-api-key-secret
ACCESS_TOKEN=your-twitter-access-token
ACCESS_TOKEN_SECRET=your-twitter-access-token-secret
OPENAI_API_KEY=your-openai-api-key
To use the Twitter bot, follow these steps:
-
Run the
lambda_handler
function in thebot.py
file. -
The bot will generate a random theme poem within 120 characters using OpenAI's text generation model.
-
The generated poem, along with relevant hashtags, will be posted to the Twitter account @momo123us.
Contributions to the project are welcome. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.