hashbot is a prototype twitch bot made in Go. Type \join in the bot's channel to join it to your chat.
Check out this link
Fork the repository on github:
Clone your fork using git and create a new branch for your changes:
git clone https://github.com/<your username>/hashbot
cd hashbot
git checkout -b my-improvement-on-x-y-zCheck the next section for instructions on how to test the bot locally.
After making your changes, commit and push them:
git add changed-file.go
git commit -m "Changed x, improved z"
git push origin my-improvement-on-x-y-z
Then make a pull request.
Requires:
The bot takes arguments using CLI arguments, either using go run main.go to run straigth from source code or the binary in the releases section with ./hashbot-linux (on linux, remember to chmod +x hashbot-linux first).
Alternatively, run it with docker:
docker buildx build -t hashbot --secret id=cloudflaredtoken,src=$HOME/.cloudflared .
docker run -d --name hashbot -p 8080:8080 -v $HOME/.hashbot_db:/database hashbot
You may use a website like twitch token generator to get a token for your bot. You'll also need a client id by creating an application in the twitch dev console. These will be placed in the bot's config file as specified in the following section.
Extract strings to translate:
goi18n extract && goi18n merge active.*.toml
Merge translated strings:
goi18n merge active.*.toml translate.*.toml
The bot loads configurations from a json file. A template is created for you if the config file you specify doesn't exist yet:
➜ hashbot git:(main) go run main.go -cfg config.hb
2024-10-01 10:00:23 WRN config file does not exist, creating from template path=config.json
2024-10-01 10:00:23 INF template created successfully, please edit the file and run the bot again path=config.hbAfter that, edit the config file using a text editor and add your settings, then run it again. If a valid config file was provided, the bot will run and an sqlite3 file will be created in the path specified in the config file containing the database:
➜ hashbot git:(main) go run main.go -cfg config.hb
2024-10-01 10:01:36 INF connected to Twitch login=hashtablebot
2024-10-01 10:01:36 INF successfully joined saved channels channels=["hash_table"]
2024-10-01 10:01:36 INF joined channel channel=hash_table