91 lines
2.0 KiB
Markdown
91 lines
2.0 KiB
Markdown
# Twitch Fish Bot
|
|
|
|
A Go bot that automatically sends `!fish` to a Twitch channel every 5 minutes.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
twitch-fish-bot/
|
|
├── cmd/
|
|
│ └── main.go
|
|
├── internal/
|
|
│ ├── clients/
|
|
│ │ └── bot.go
|
|
│ └── config/
|
|
│ └── config.go
|
|
├── go.mod
|
|
└── README.md
|
|
```
|
|
|
|
## Setup Instructions
|
|
|
|
### Create the project directory:
|
|
|
|
```bash
|
|
mkdir twitch-fish-bot
|
|
cd twitch-fish-bot
|
|
```
|
|
|
|
### Create the directory structure:
|
|
|
|
```bash
|
|
mkdir -p cmd internal/clients internal/config
|
|
```
|
|
|
|
### Create each file with the content provided in the artifacts
|
|
|
|
### Initialize Go module:
|
|
|
|
```bash
|
|
go mod init twitch-fish-bot
|
|
```
|
|
|
|
### Update configuration:
|
|
|
|
Edit `internal/config/config.go`
|
|
|
|
Replace the placeholder values with your actual:
|
|
- Bot username
|
|
- OAuth token (from [twitchtokengenerator.com](https://twitchtokengenerator.com/))
|
|
- Client ID (from [twitchtokengenerator.com](https://twitchtokengenerator.com/) - required as of May 1st)
|
|
- Target channel name
|
|
|
|
### Run the bot:
|
|
|
|
```bash
|
|
go run cmd/main.go
|
|
```
|
|
|
|
## Getting Credentials
|
|
|
|
1. Go to [twitchtokengenerator.com](https://twitchtokengenerator.com/)
|
|
2. Select "Bot Chat Token"
|
|
3. Get both the OAuth Token and Client ID from the generated output
|
|
4. Update `internal/config/config.go` with these values
|
|
|
|
## Features
|
|
|
|
- Clean architecture with separated concerns
|
|
- Graceful shutdown with Ctrl+C handling
|
|
- Proper logging with timestamps
|
|
- Connection management with automatic PING/PONG handling
|
|
- Error handling throughout the application
|
|
- Client ID support for Helix API compliance
|
|
- Configurable through the config package
|
|
|
|
## Usage
|
|
|
|
The bot will:
|
|
- Connect to Twitch IRC
|
|
- Join the specified channel
|
|
- Send `!fish` immediately after joining
|
|
- Continue sending `!fish` every 5 minutes
|
|
- Run until stopped with Ctrl+C
|
|
|
|
## Notes
|
|
|
|
- Make sure your bot account isn't banned from the target channel
|
|
- Consider asking the streamer for permission before running automated bots
|
|
- The bot logs all chat messages - remove this if you prefer privacy
|
|
|