Find a file
2026-01-21 04:57:56 +00:00
cmd feat: Prepare for Nix deployment with integration tests and flake 2026-01-16 21:57:13 +00:00
docs chore: Harden systemd service and pin nixpkgs to stable 2026-01-16 22:51:51 +00:00
internal fix: increase websocket read limit to 1MB 2026-01-21 04:57:56 +00:00
pkg/config Initial commit: MusicLink bot for cross-platform music link conversion 2026-01-09 00:56:17 +00:00
.gitignore feat: Prepare for Nix deployment with integration tests and flake 2026-01-16 21:57:13 +00:00
config.example.toml Initial commit: MusicLink bot for cross-platform music link conversion 2026-01-09 00:56:17 +00:00
flake.lock chore: Harden systemd service and pin nixpkgs to stable 2026-01-16 22:51:51 +00:00
flake.nix fix: resolve websocket panic and add NixOS module 2026-01-20 23:46:14 +00:00
go.mod Initial commit: MusicLink bot for cross-platform music link conversion 2026-01-09 00:56:17 +00:00
go.sum Initial commit: MusicLink bot for cross-platform music link conversion 2026-01-09 00:56:17 +00:00
LICENSE feat: Prepare for Nix deployment with integration tests and flake 2026-01-16 21:57:13 +00:00
README.md feat: Prepare for Nix deployment with integration tests and flake 2026-01-16 21:57:13 +00:00
WORKLOG.md fix: resolve repeated read panic by pinning connection in goroutines 2026-01-21 04:47:47 +00:00

MusicLink Bot

MusicLink is a Go-based chat bot that automatically detects music links (Spotify, Apple Music, YouTube, etc.) and responds with links to the same song on other streaming platforms. It solves the "I don't have Spotify" problem in group chats.

Architecture

MusicLink is designed to work as a sidecar to Matterbridge.

  • Connectivity: Connects to Matterbridge via its WebSocket API. This allows MusicLink to support any chat platform Matterbridge supports (Discord, Slack, Telegram, Matrix, IRC, etc.).
  • Resolution: Uses the idonthavespotify API to convert links between services without requiring individual API keys.
  • Privacy: Does not store messages or user data. It only processes messages containing music links.

Getting Started

Prerequisites

  • Go 1.22 or higher
  • A running instance of Matterbridge (if running in production)

Building

go build -o musiclink ./cmd/musiclink

Configuration

  1. Copy the example configuration:

    cp config.example.toml config.toml
    
  2. Edit config.toml to match your Matterbridge WebSocket settings:

    [matterbridge]
    url = "ws://localhost:4242/api/websocket"
    token = "your-matterbridge-api-token"
    gateway = "main" # The gateway name defined in your matterbridge.toml
    username = "MusicLink"
    

Running

./musiclink -config config.toml

Testing

The project includes both unit tests and integration tests.

Run All Tests

go test ./...

Integration Tests

The integration tests (in internal/bot/bot_integration_test.go) mock both the Matterbridge WebSocket server and the music resolution API. This allows you to verify the bot's full logic flow without external dependencies.

go test -v internal/bot/bot_integration_test.go

Smoke Test

A manual smoke test script is available in cmd/smoketest:

go run cmd/smoketest/main.go

License

MIT