This is a small python bot for tweeting out auto generated text from openai
So I don't really know anything about licenses, so just kinda go wild I guess. It'd be appreciated if you were to edit the code though, even if it's just the prompt you send to openai
You are going to need a few python modules, in your environment (I would suggest virtual environment) you will need to run these 4 commands
python -m pip install requests_oauthlib
python -m pip install openai
python -m pip install python-dotenv
(I don't use just plain dotenv
as it doesn't seem to work with python 3.10.4 which is what I am on, this fixes that though)
python -m pip install schedule
Nice and simple, create both accounts, make sure you save all the api keys you are given (you will need a few of them) also make sure you make your twitter account a developer account this website will help
Then you need to create a .env file in the same directory as main.py inside you will need
API_KEY=
which should equal the openai key given by your openai account
TWITTER_API_KEY=
which is the given when you create your developer account for twitter (along with two other keys)
TWITTER_API_SECRET_KEY=
similar to the one above but secret
TWITTER_ACCESS_TOKEN=
These are gotten by using the api url "https://api.twitter.com/oauth/authorize" it's a bit of a pain and I got mine from following (copying) the code from this repo and just saving the output of access_token and access_token_secret.
TWITTER_SECRET_ACCESS_TOKEN=
Same as above
Ok you are good to go!
So yeah that's kinda it, a simple bot, with generally poorly written code, plans for the future are to rewrite to be more efficient (both in python, and then some other languages) It doesn't need to be more efficient it runs a function once a day and doesn't work it real time. Still if it is running on my server in the background, i'd prefer it to have a low footprint