Twitter bot backed by ChatGPT.
go get -v github.com/zquestz/go-chatgpt-twitter-bot
cd $GOPATH/src/github.com/zquestz/go-chatgpt-twitter-bot
make
make install
There are quite a few API keys and ENV vars to setup. You can use a .env
file if you want. We use the Twitter v2 API, and OpenAI.
TWITTER_BEARER_TOKEN=
TWITTER_CONSUMER_API_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_SECRET=
OPENAI_API_KEY=
OPENAI_CHARACTER_BACKGROUND=
Make sure to setup a character background. This will be the personality that will post tweets!
Usage:
go-chatgpt-twitter-bot <handle> [flags]
Flags:
-b, --bot launch in bot mode
--completion string completion script for bash, zsh, fish or powershell
-d, --dryrun dryrun mode
-h, --help help for go-chatgpt-twitter-bot
-p, --prompt string prompt for the generator (default "Generate a tweet!")
--userid string twitter userid (default "me")
-v, --verbose verbose mode
--version display version
Autocompletion is supported. To set up autocompletion:
go-chatgpt-twitter-bot --completion bash > /etc/bash_completion.d/go-chatgpt-twitter-bot
go-chatgpt-twitter-bot --completion bash > /usr/local/etc/bash_completion.d/go-chatgpt-twitter-bot
Generate a _go-chatgpt-twitter-bot
completion script and put it somewhere in your $fpath
:
go-chatgpt-twitter-bot --completion zsh > /usr/local/share/zsh/site-functions/_go-chatgpt-twitter-bot
go-chatgpt-twitter-bot --completion fish > ~/.config/fish/completions/go-chatgpt-twitter-bot
(& go-chatgpt-twitter-bot --completion powershell) | Out-String | Invoke-Expression
To setup your own default configuration just create ~/.config/go-chatgpt-twitter-bot/config
. The configuration file is in UCL format. JSON is also fully supported as UCL can parse JSON files.
For more information about UCL visit: https://github.com/vstakhov/libucl
The following keys are supported:
- bot (launch in bot mode) - Unfinished
- character_background (bot personality)
- dryrun (don't post to twitter)
- handle (twitter handle)
- prompt (prompt for the generator)
- userid (twitter userid)
- verbose (verbose mode)
go-chatgpt-twitter-bot is released under the MIT license.