A Reddit bot that provides the ability to search and replace parent comments. Supports Go regular expression syntax. Aim is not to support everything, just very simple replacement. This is a port of the original Ruby substitute-bot into Go.
This project uses Go modules so please use a version of Go (>= 1.11) that supports them. This has been developed and tested with Go 1.13.1.
- Clone this repo
- The following environment variables are required to run:
SUBSTITUTE_BOT_CLIENT_ID=<YOUR_REDDIT_CLIENT_ID>
SUBSTITUTE_BOT_CLIENT_SECRET=<YOUR_REDDIT_CLIENT_SECRET>
SUBSTITUTE_BOT_USERNAME=<YOUR_REDDIT_USERNAME>
SUBSTITUTE_BOT_PASSWORD=<YOUR_REDDIT_PASSWORD>
SUBSTITUTE_BOT_USER_AGENT=<USER_AGENT_TO_USE_WITH_REDDIT_API_CALLS>
- The following environment variables are optional:
SUBSTITUTE_BOT_PORT=<PORT_NUMBER_FOR_WEB_FRONTEND>
(only used by web frontend; defaults to 3000)
- To run the bot:
go run cmd/bot/main.go
- To run the web frontend that shows recent replies:
go run cmd/bot/main.go cmd/bot/index.html.go cmd/bot/style.css.go
- Some of the tests utilize Gingko/Gomega
go test --cover --short ./...
You can check out the live running web frontend @ https://substitute-bot.electrostat.xyz