https://github.com/0ncorhynchus/cycle-twitter-bot
https://github.com/0ncorhynchus/cycle-twitter-bot
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/0ncorhynchus/cycle-twitter-bot
- Owner: 0ncorhynchus
- Created: 2020-09-13T06:40:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-14T06:44:47.000Z (over 4 years ago)
- Last Synced: 2023-08-03T05:03:30.195Z (almost 2 years ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cycle-twitter-bot
The twitter bot repeats given tweets randomly.
## SQL Setup
This bot fetches tweets from `PostgreSQL`.
First of all, you need to store tweets into a table in the SQL.```console
$ pgsql -c "CREATE tweets (tweet text, not_yet boolean)"
$ pgsql -c "INSERT INTO tweets VALUES ('$tweet1', TRUE)"
$ pgsql -c "INSERT INTO tweets VALUES ('$tweet2', TRUE)"
$ # ...
$ # you can also copy tweets from a file (e.g. 'tweets.csv')
$ # please refer the documentation of PostgreSQL or some others.
```## Environment Variables
This bot get some values from the environment variables.
You need to set the below variables before running this.| variable | value |
|---------------------|---------------------------------------------|
| CONSUMER_KEY | Consumer API key of your twitter app |
| CONSUMER_SECRET | Consumer API secret key of your twitter app |
| ACCESS_TOKEN | Access token of your account |
| ACCESS_TOKEN_SECRET | Access token secret of your account |
| DATABASE_URL | URL to your `PostgreSQL` database |## Run
```console
$ go build
$ env # Ensure environemnt variables are correctly set before running
...
CONSUMER_KEY=...
CONSUMER_SECRET_KEY=...
ACCESS_TOKEN=...
ACCESS_TOKEN_SECRET=...
DATABASE_URL=...
...
$ ./cycle-twitter-bot
```