Find a file
2026-01-22 01:02:57 -08:00
cmd Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08:00
docs Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08:00
internal Disable link previews for Matrix replies 2026-01-22 01:02:57 -08:00
pkg/config Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08:00
vendor Update vendor directory and flake hash 2026-01-21 22:42:18 -08:00
.gitignore feat: Prepare for Nix deployment with integration tests and flake 2026-01-16 21:57:13 +00:00
config.example.toml Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08:00
flake.lock chore: Harden systemd service and pin nixpkgs to stable 2026-01-16 22:51:51 +00:00
flake.nix Use vendored deps in nix build 2026-01-21 22:45:17 -08:00
go.mod Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08:00
go.sum Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08:00
LICENSE feat: Prepare for Nix deployment with integration tests and flake 2026-01-16 21:57:13 +00:00
README.md Deprecate matterbridge and fix matrix issues 2026-01-21 22:26:58 -08: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 a Matrix-native bot that connects directly to a Matrix homeserver and replies in the originating room/thread. E2EE rooms are not supported.

  • Connectivity: Connects directly to Matrix and supports multiple allowlisted rooms.
  • 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 Matrix homeserver and bot access token

Building

go build -o musiclink ./cmd/musiclink

Configuration

  1. Copy the example configuration:

    cp config.example.toml config.toml
    
  2. Configure Matrix-native mode (replies in the originating room/thread; E2EE rooms not supported):

    [matrix]
    shadow = false # set true to log-only during validation
    healthAddr = ":8080" # optional health/metrics endpoint
    server = "https://matrix.example.com"
    accessToken = "your-matrix-access-token"
    userId = "@musiclink:example.com"
    rooms = ["!roomid:example.com"]
    stateStorePath = "data/matrix-state.db"
    

Running

./musiclink -config config.toml

Health and Metrics (Matrix-native)

If matrix.healthAddr is set, MusicLink exposes JSON health stats at /healthz (and /metrics). Example:

curl http://localhost:8080/healthz

Testing

The project includes both unit tests and integration tests.

Run All Tests

go test ./...

Integration Tests

No Matrix integration tests are included yet; add them as needed.

Smoke Test

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

go run cmd/smoketest/main.go

License

MIT