For an active fork, check out https://git.roshless.me/roshless/mumbledj
A Mumble bot that plays audio fetched from various media websites.
- Plays audio from many media websites, including YouTube, SoundCloud, and Mixcloud.
- Supports playlists and individual videos/tracks.
- Displays metadata in the text chat whenever a new track starts playing.
- Plays audio samples embedded in binary and from filesystem More Info
- Incredibly customizable. Nearly everything is able to be tweaked via configuration files (by default located at
$HOME/.config/mumbledj/config.yaml
). - A large array of commands that perform a wide variety of functions.
- Built-in vote-skipping.
- Built-in caching system (disabled by default).
- Built-in play/pause/volume control.
IMPORTANT NOTE: MumbleDJ is only tested and developed for Linux systems. If something doesn't work in Windows and the others OS, create an issue please.
All MumbleDJ installations must also have the following installed:
yt-dlp
(alternatively,youtube-dl
works but infrequent updates mean it may not be able to play all videos)ffmpeg
aria2
if you plan on using services that throttle download speeds (like Mixcloud)openssl
if you plan using p12 certificates for authentication
If installing via go install
or from source, the following must be installed:
- Go 1.11+
- If the repositories for your distro contain a version of Go older than 1.11, try using
gvm
to install Go 1.11 or newer.
- If the repositories for your distro contain a version of Go older than 1.11, try using
A YouTube API key must be present in your configuration file in order to use the YouTube service within the bot. Below is a guide for retrieving an API key:
1) Navigate to the Google Developers Console and sign in with your Google account, or create one if you haven't already.
2) Click the "Create Project" button and give your project a name. It doesn't matter what you set your project name to. Once you have a name click the "Create" button. You should be redirected to your new project once it's ready.
3) Click on "APIs & auth" on the sidebar, and then click APIs. Under the "YouTube APIs" header, click "YouTube Data API". Click on the "Enable API" button.
4) Click on the "Credentials" option underneath "APIs & auth" on the sidebar. Underneath "Public API access" click on "Create New Key". Choose the "Server key" option.
5) Add the IP address of the machine MumbleDJ will run on in the box that appears (this is optional, but improves security). Click "Create".
6) You should now see that an API key has been generated. Copy/paste this API key into the configuration file located at $HOME/.config/mumbledj/config.yaml
.
A SoundCloud client ID must be present in your configuration file in order to use the SoundCloud service within the bot. Below is a guide for retrieving a client ID:
1) Login/sign up for a SoundCloud account on https://soundcloud.com.
2) Create a new app: https://soundcloud.com/you/apps/new.
3) You should now see that a client ID has been generated. Copy/paste this ID (NOT the client secret) into the configuration file located at $HOME/.config/mumbledj/config.yaml
.
First, clone the MumbleDJ repository to your machine:
git clone https://github.com/reikion/mumbledj
Install the required software as described in the requirements section, and execute the following:
make
This will place a compiled mumbledj
binary in the cloned directory if successful. If you would like to make the binary more accessible by adding it to /usr/local/bin
, simply execute the following:
sudo make install
Pre-compiled binaries are provided for convenience. Overall, I do not recommend using these unless you cannot get go install
to work properly. Binaries compiled on your own machine are likely more efficient as these binaries are cross-compiled from a 64-bit Linux system.
After verifying that the requirements are installed, simply visit the releases page and download the appropriate binary for your platform.
You can also use Docker to run MumbleDJ.
Assuming you have Docker installed, you can run it like this, passing the configuration through the command line:
docker run --rm --name=mumbledj ghcr.io/leoverto/mumbledj --server=SERVER --api_keys.youtube=YOUR_YOUTUBE_API_KEY --api_keys.soundcloud=YOUR_SOUNDCLOUD_API_KEY
In order to run the process as a daemon and restart it automatically on reboot you can use:
docker run -d --restart=unless-stopped --name=mumbledj ghcr.io/leoverto/mumbledj --server=SERVER --api_keys.youtube=YOUR_YOUTUBE_API_KEY --api_keys.soundcloud=YOUR_SOUNDCLOUD_API_KEY
You can embed your config.yaml into binary if you plan to compile Mumbledj from source. Please note that everybody, who can open Mumbledj
binary in text editor can also read your API secrets!
To embed default config copy assets/config.yaml.example
to assets/assets/config.yaml
and customize as needed.
MumbleDJ allows to play random flac samples from given category embedded in binary and from filesystem. To embed samples:
- create
assets
directory in source codeassets
directory - create category folder for samples, i.e.
wololo
- put sample in that folder named in format
1.flac
,2.flac
etc.
To play samples from filesystem you need the same layout of files, but you need drop your assets directory in current working directory of MumbleDJ.
Example of structure of files in MumbleDJ source code:
assets
├── assets
│ ├── config.yaml
│ ├── nani
│ │ ├── 1.flac
│ └── wololo
│ ├── 1.flac
│ └── 2.flac
├── assets.go
└── config.yaml.example
Example of structure of files in filesystem. MumbleDJ has been started from /home/mumbledj
/home/mumbledj/assets
├── nani
│ ├── 1.flac
└── wololo
├── 1.flac
└── 2.flac
To play sample you need to use ohohoho command. Please note that MumbleDJ needs to be restarted to discover new category created in filesystem.
MumbleDJ is a compiled program that is executed via a terminal.
Here is an example helptext that gives you a feel for the various commandline arguments you can give MumbleDJ:
NAME:
MumbleDJ - A Mumble bot that plays audio from various media sites.
USAGE:
mumbledj [global options] command [command options] [arguments...]
VERSION:
v3.7.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--config value, -c value location of MumbleDJ configuration file (default: "/home/mumbledj/.config/mumbledj/config.yaml")
--server value, -s value address of Mumble server to connect to (default: "127.0.0.1")
--port value, -o value port of Mumble server to connect to (default: "64738")
--username value, -u value username for the bot (default: "MumbleDJ")
--password value, -p value password for the Mumble server
--channel value, -n value channel the bot enters after connecting to the Mumble server
--p12 value path to user p12 file for authenticating as a registered user
--cert value, -e value path to PEM certificate
--key value, -k value path to PEM key
--accesstokens value, -a value list of access tokens separated by spaces
--insecure, -i if present, the bot will not check Mumble certs for consistency (default: false)
--debug, -d if present, all debug messages will be shown (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)
NOTE: You can also override all settings found within config.yaml
directly from the commandline. Here's an example:
mumbledj --admins.names="SuperUser,Matt" --volume.default="0.5" --volume.lowest="0.2" --queue.automatic_shuffle_on="true"
Keep in mind that values that contain commas (such as "SuperUser,Matt"
) will be interpreted as string slices, or arrays if you are not familiar with Go. If you want your value to be interpreted as a normal string, it is best to avoid commas for now.
- Description: Adds a track or playlist from a media site to the queue.
- Default Aliases: add, a
- Arguments: (Required) URL(s) to a track or playlist from a supported media site.
- Admin-only by default: No
- Example:
!add https://www.youtube.com/watch?v=KQY9zrjPBjo
- Description: Adds a track or playlist from a media site as the next item in the queue.
- Default Aliases: addnext, an
- Arguments: (Required) URL(s) to a track or playlist from a supported media site.
- Admin-only by default: Yes
- Example:
!addnext https://www.youtube.com/watch?v=KQY9zrjPBjo
- Description: Outputs the file size of the cache in MiB if caching is enabled.
- Default Aliases: cachesize, cs
- Arguments: None
- Admin-only by default: Yes
- Example:
!cachesize
- Description: Outputs information about the current track in the queue if one exists.
- Default Aliases: currenttrack, currentsong, current
- Arguments: None
- Admin-only by default: No
- Example:
!currenttrack
- Description: Immediately skips the current track.
- Default Aliases: forceskip, fs
- Arguments: None
- Admin-only by default: Yes
- Example:
!forceskip
- Description: Immediately skips the current playlist.
- Default Aliases: forceskipplaylist, fsp
- Arguments: None
- Admin-only by default: Yes
- Example:
!forceskipplaylist
- Description: Outputs a list of available commands and their descriptions.
- Default Aliases: help, h
- Arguments: None
- Admin-only by default: No
- Example:
!help
- Description: Moves MumbleDJ into your current channel if not playing audio to someone else.
- Default Aliases: joinme, join
- Arguments: None
- Admin-only by default: Yes
- Example:
!joinme
- Description: Stops the bot and cleans its cache directory.
- Default Aliases: kill, k
- Arguments: None
- Admin-only by default: Yes
- Example:
!kill
- Description: Outputs a list of the tracks currently in the queue.
- Default Aliases: listtracks, listsongs, list, l
- Arguments: (Optional) Number of tracks to list
- Admin-only by default: No
- Example:
!listtracks 10
- Description: Moves the bot into the Mumble channel provided via argument.
- Default Aliases: move, m
- Arguments: (Required) Mumble channel to move the bot into
- Admin-only by default: Yes
- Example:
!move Music
- Description: Outputs information about the next track in the queue if one exists.
- Default Aliases: nexttrack, nextsong, next
- Arguments: None
- Admin-only by default: No
- Example:
!nexttrack
- Description: Outputs the number of tracks cached on disk if caching is enabled.
- Default Aliases: numcached, nc
- Arguments: None
- Admin-only by default: Yes
- Example:
!numcached
- Description: Outputs the number of tracks currently in the queue.
- Default Aliases: numtracks, numsongs, nt
- Arguments: None
- Admin-only by default: No
- Example:
!numtracks
- Description: "Sample player of ohohoho and the others samples"
- Default Aliases: ohohoho, oh
- Arguments:
- None to list categories
- category name
- (Optional) how many times to play random samples from given category
- Admin-only by default: No
- Example:
!oh wololo 10
- Description: Pauses audio playback.
- Default Aliases: pause
- Arguments: None
- Admin-only by default: No
- Example:
!pause
- Description: Registers the bot on the server.
- Default Aliases: register, reg
- Arguments: None
- Admin-only by default: Yes
- Example:
!register
- Description: Reloads the configuration file.
- Default Aliases: reload, r
- Arguments: None
- Admin-only by default: Yes
- Example:
!reload
- Description: Resets the queue by removing all queue items.
- Default Aliases: reset, re
- Arguments: None
- Admin-only by default: Yes
- Example:
!reset
- Description: Resumes audio playback.
- Default Aliases: resume
- Arguments: None
- Admin-only by default: No
- Example:
!pause
- Description: Search for track and add it to the queue.
- Default Aliases: search, se
- Arguments: Search query for search engine
- Admin-only by default: No
- Example:
!search techno union
- Description: Sets the comment displayed next to MumbleDJ's username in Mumble. If the argument is left empty, the current comment is removed.
- Default Aliases: setcomment, comment, sc
- Arguments: (Optional) New comment
- Admin-only by default: Yes
- Example:
!setcomment Hello! I'm a bot. Beep boop.
- Description: Randomizes the tracks currently in the queue.
- Default Aliases: shuffle, shuf, sh
- Arguments: None
- Admin-only by default: Yes
- Example:
!shuffle
- Description: Places a vote to skip the current track.
- Default Aliases: skip, s
- Arguments: None
- Admin-only by default: No
- Example:
!skip
- Description: Places a vote to skip the current playlist.
- Default Aliases: skipplaylist, sp
- Arguments: None
- Admin-only by default: No
- Example:
!skipplaylist
- Description: Toggles permanent track shuffling on/off.
- Default Aliases: toggleshuffle, toggleshuf, togshuf, tsh
- Arguments: None
- Admin-only by default: Yes
- Example:
!toggleshuffle
- Description: Outputs the current version of MumbleDJ.
- Default Aliases: version, v
- Arguments: None
- Admin-only by default: No
- Example:
!version
- Description: Changes the volume if an argument is provided, outputs the current volume otherwise.
- Default Aliases: volume, vol
- Arguments: (Optional) New volume
- Admin-only by default: No
- Example:
!volume 0.5
Contributions to MumbleDJ are always welcome!
The MIT License (MIT)
Copyright (c) 2016 Matthieu Grieger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.