Sonarous is a Discord music bot written in Java. It uses the Discord4J library to communicate with Discord, as well as a number of other libraries to decode and manipulate audio.
The following is a short overview of the commands offered by Sonarous.
Command | Usage | Description |
---|---|---|
help | help | Provides a link to this document. |
setprefix | setprefix prefix |
Sets the command prefix in a specific server. |
halt | halt reason | Kills the bot. |
bind | bind | Binds the bot to a voice channel. |
unbind | unbind | Unbinds the bot from whatever voice channel it's in. |
Command | Usage | Description |
---|---|---|
skip | skip | Votes to skip the current song. Requires a majority to successfully skip. |
forceskip | forceskip | Forcefully skips the current song. |
pause | pause | Temporarily pauses playback. |
unpause | unpause | Resumes paused playback. |
volume | volume decibels | Sets the bot's playback volume in decibels. Ranges from -2147483648 to 6 dB. |
playing | playing | Gets the currently playing song. |
Command | Usage | Description |
---|---|---|
play | play songUrl | Attempts to queue a song from the given link. |
search | search provider query | Searches for a song provided by a given provider. |
result | result index | Adds a search result to the queue. |
lsqueue | lsqueue | Lists currently queued songs. |
unqueue | unqueue index | Removes the queued song at the given index. |
Command | Usage | Description |
---|---|---|
lssop | lssop | Lists available song providers. |
lssep | lssep | Lists available search providers. |
In order to parse songs and searches, Sonarous exposes elements called "song providers" and "search providers". Essentially, they function to parse your input and convert them to songs and searches for a given song service. For example, a SoundCloud song provider parses SoundCloud URLs and tries to grab music tracks for playback. Similarly, a SoundCloud search provider searches SoundCloud for songs using user-provided search queries. In order to use a particular music service with Sonarous, you need a song provider and/or search provider for that service.
In order to run the bot, you'll need a file called sonarous_cfg.json
in the working directory. The file should look something like this:
{
"token": "abcdefghijklmnopqrstuvwxyz",
"prefix": "!",
"admin": "1234567890123456",
"providers": {
...
},
"ffmpeg": {
"ffmpegPath": "path/to/ffmpeg",
"ffprobePath": "path/to/ffprobe"
}
}
The parameters seem pretty self-explanatory, but here's a table of them anyways:
Parameter | Type | Function |
---|---|---|
token | String | The bot's oauth token. |
prefix | String | The bot's default command prefix. |
admin | String | The bot owner's user ID. |
providers | Map | Provider configuration. See below. |
ffmpeg | Map | FFmpeg configuration. |
ffmpegPath | Path | Path to the ffmpeg executable. |
ffprobePath | Path | Path to the ffprobe executable. |
Requires an FFmpeg installation to be configured, as well as (ytdl)[https://github.com/rylio/ytdl]. The configuration should look like this:
"providers": {
"youtube": {
"ytdlPath": "path/to/ytdl/executable"
}
}
Requires a SoundCloud client ID. The configuration should look like this:
"providers": {
"soundcloud": {
"apiKey": "clientId12345678"
}
}