Captain, it's Wednesday!
This tiny script automated that reminds me when it's Wednesday and asks me if I want to tweet this meme:
It only asks, at maximum, once in the morning, once in the afternoon and once on the evening — and it stops asking when it has already tweeted in any given Wednesday.
Requirements
- Make sure you have Go 1.16 (or newer)
- Right now,
go-twitter
doesn't have all we need, so we're using a local branch to compile:
- Clone
go-twitter
to the parent directory (one level up from this repo's directory)
- Git pull
drswork
's branch there
Once this PR is merged, everything will be way easier.
Also I have not tested in Windows.
Basic usage
- Create an application and get your API keys from Twitter's Developer platform
- Create environment variables with the keys:
WEDNESDAY_CONSUMER_KEY
WEDNESDAY_CONSUMER_SECRET
WEDNESDAY_ACCESS_TOKEN
WEDNESDAY_ACCESS_TOKEN_SECRET
- Run with
go run main.go cache.go
How I use it (opinionated)
I integrated in a way that when it's Wednesday my computer asks me if I want to tweet the meme.
First, I have generated the binary in a directory that is already in my PATH
, for example:
go build -o /usr/local/bin/it-wednesday
Then I call this program for every new terminal session. In my case, I Fish, so I added this block to my .config/fish/config.fish
:
set -x WEDNESDAY_CONSUMER_KEY …
set -x WEDNESDAY_CONSUMER_SECRET …
set -x WEDNESDAY_ACCESS_TOKEN …
set -x WEDNESDAY_ACCESS_TOKEN_SECRET …
its-wednesday
If you use Bash or Zsh, feel free to send a PR with compatible instructions :)