Skip to content

Subcordant is a Discord bot that streams music from your Subsonic-API compatible server.

License

Notifications You must be signed in to change notification settings

apkatsikas/subcordant

Repository files navigation

subcordant

 subcordant Discord

Subcordant is a Discord bot that streams music from your Subsonic-API compatible server.

Available Commands

  • /play - takes a subsonicid parameter. Connects the bot to the voice channel currently occupied by the command issuer, if it is not yet connected. Enqueues all tracks from the specified album, playlist or track and initates playback, if not already playing. If the bot is already present in a different voice channel, playback will stop, the current playlist will be cleared and the bot will join the new channel
  • /albumtrack - takes an albumid parameter and tracknumber parameter. Behaves the same as the /play command, but instead targets a single track from the specified album/track number combination
  • /trackname - takes a trackname parameter. Behaves the same as the albumtrack command, but instead takes the track name
  • /albumname - takes an albumname parameter. Behaves the same as the albumtrack command, but instead takes the album name
  • /clear - clears the playlist and stops playback
  • /disconnect - disconnects the subcordant bot, stopping playback and clearing the playlist
  • /skip - skips the currently playing song
  • /help - describes all commands

Building

Depending on your operating system, run either libdave_install.sh or libdave_install.ps1. For more info see the docs.

Run make build.

Pre-requisites

Running

Run the executable, specifying the following environment variables:

  • SUBSONIC_URL
  • SUBSONIC_USER
  • SUBSONIC_PASSWORD
  • DISCORD_BOT_TOKEN

Flags

The following flags are available:

  • streamFrom - valid values are stream or file, defaults to stream if not specified. Subcordant will stream to the voice chat using:
    • stream - the Subsonic /stream endpoint
    • file - the file path returned from the path field on the song. This mode will only work if subcordant has access to the audio library folder, and that the API returns the actual absolute path of the song. For Navidrome, an admin can toggle to allow the subcordant player to Report Real Path, or use the Subsonic.DefaultReportRealPath configuration option. Consult your server's documentation for more information.
  • idleDisconnectTimeout - duration in minutes after which bot will disconnect when no music is playing. Defaults to 5 if not specified.

Installing as a systemd unit

These instructions are for installing subcordant as a systemd unit on Linux. This enables subcordant to run on machine startup.

  1. Run make build or download a binary from the releases page
  2. Create a directory at /opt/subcordant
  3. Add your subcordant executable to this path
  4. Run chmod +x /opt/subcordant/subcordant
  5. Run groupadd subcordant
  6. Run useradd -m -g subcordant subcordant
  7. Run chown subcordant:subcordant /opt/subcordant
  8. Run vim /etc/systemd/system/subcordant.service and copy the contents of docs/subcordant.service into the file, replacing all the environment variable instances of foobar with your values.
  9. Run systemctl daemon-reload
  10. Run systemctl start subcordant.service
  11. Run systemctl status subcordant.service

Contributing

Please see the Issues associated with this repo to help contribute.

Testing

Run make run-tests.

Subcordant makes use of the following:

  • Ginkgo - testing framework
  • Mockery - for generating mocks from interfaces
  • Testify - for the mock package

About

Subcordant is a Discord bot that streams music from your Subsonic-API compatible server.

Resources

License

Stars

Watchers

Forks

Contributors