Skip to content

yuu1111/StreamNotifier

Repository files navigation

StreamNotifier

Go License: MIT

A CLI tool that monitors Twitch streamer status changes via polling and sends notifications to Discord Webhooks.

日本語

Features

  • Real-time monitoring of Twitch streamer status via Helix API polling
  • Discord Webhook notifications for:
    • Stream online / offline
    • Title changes
    • Game/category changes
  • Multi-streamer and multi-webhook support per streamer
  • Interactive CLI menu for configuration management
  • Structured logging with slog (colored console + JSON file)

Requirements

  • Go 1.25+
  • Twitch Developer Application (dev.twitch.tv)
  • Discord Webhook URL(s)

Quick Start

1. Clone and build

git clone https://github.com/yuu1111/StreamNotifier.git
cd StreamNotifier
make build

2. Configure

Copy the example config and fill in your credentials:

cp config.example.json config.json
{
  "twitch": {
    "clientId": "your_twitch_client_id",
    "clientSecret": "your_twitch_client_secret"
  },
  "polling": {
    "intervalSeconds": 30
  },
  "streamers": [
    {
      "username": "streamer_name",
      "webhooks": [
        {
          "name": "Main Notification",
          "url": "https://discord.com/api/webhooks/...",
          "notifications": {
            "online": true,
            "offline": true,
            "titleChange": true,
            "gameChange": true
          }
        }
      ]
    }
  ],
  "log": {
    "level": "info"
  }
}

3. Run

./stream-notifier

Or use the interactive CLI:

./stream-notifier help

Docker

docker build -t stream-notifier .
docker run -v ./config.json:/app/config.json:ro -v ./logs:/app/logs stream-notifier

Build

make build          # Build for current platform
make build-all      # Build for Linux, Windows, macOS
make clean          # Remove build artifacts

Architecture

cmd/stream-notifier/main.go    Entry point
internal/
├── cli/cli.go                 Interactive menu + subcommands
├── config/config.go           Config struct, JSON loader, validation
├── discord/
│   ├── embed.go               Discord embed builder
│   └── webhook.go             Webhook sender
├── monitor/
│   ├── detector.go            State change detection
│   ├── poller.go              Periodic polling
│   └── state.go               In-memory streamer state
└── twitch/
    ├── api.go                 Helix API client
    ├── auth.go                OAuth2 Client Credentials
    └── types.go               API response types

Data flow: PollerTwitchAPIDetectChangesBuildEmbedSendWebhook

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors