Notice: This project is no longer actively supported. Development has moved to a new repository: Melodix. Please visit the new project for the latest updates and support.
Melodix Player is my pet project that plays audio from YouTube and audio streaming links to Discord voice channels.
- πΆ Single track added by song name or YouTube link.
- πΆ Multiple tracks added via multiple YouTube links (space separated).
- πΆ Tracks from public user playlists.
- πΆ Tracks from "MIX" playlists.
- π» Streaming links (e.g., radio stations).
- π Operation across multiple Discord servers (guild management).
- π Access to history of previously played tracks with sorting options.
- πΎ Downloading tracks from YouTube as mp3 files for caching.
- πΌ Sideloading audio mp3 files.
- π¬ Sideloading video files with audio extraction as mp3 files.
- π Playback auto-resume support for connection interruptions.
- π οΈ REST API support (limited at the moment).
- π« The bot cannot play YouTube streams.
- βΈοΈ Playback auto-resume support creates noticeable pauses.
- β© Sometimes playback speed is slightly faster than intended.
- π It's not bug-free.
You can test Melodix in two ways:
-
π₯οΈ Download compiled binaries (available only for Windows). Ensure FFMPEG is installed on your system and added to the global PATH variable (or specify the path to FFMPEG directly in the
.envconfig file). Follow the "Create bot in Discord Developer Portal" section to set up the bot in Discord. -
ποΈ Join the Official Discord server and use the voice and
#bot-spamchannels.
Melodix Player supports various commands with respective aliases (if applicable). Some commands require additional parameters.
!play [title|url|stream|id](aliases:!p ..,!> ..) β Parameters: song name, YouTube URL, audio streaming URL, history ID.!skip(aliases:!next,!>>) β Skip to the next track in the queue.!pause(alias:!!) β Pause playback.!resume(aliases:!r,!!>) β Resume paused playback or start playback if a track was added via!add ...!stop(alias:!x) β Stop playback, clear the queue, and leave the voice channel.
!add [title|url|stream|id](aliases:!a,!+) β Parameters: song name, YouTube URL, audio streaming URL, history ID (same as for!play ..).!list(aliases:!queue,!l,!q) β Show the current songs queue.
!history(aliases:!time,!t) β Show history of recently played tracks. Each track in history has a unique ID for playback/queueing.!history count(aliases:!time count,!t count) β Sort history by playback count.!history duration(aliases:!time duration,!t duration) β Sort history by track duration.
!help(aliases:!h,!?) β Show help cheatsheet.!help playβ Extra information about playback commands.!help queueβ Extra information about queue commands.!about(alias:!v) β Show version (build date) and related links.whoamiβ Send user-related info to the log. Needed to set up superadmin in.envfile.
These commands are available only for superadmins (host server owners).
!curl [YouTube URL]β Download as mp3 file for later use.!cachedβ Show currently cached files (fromcacheddirectory). Each server operates its own files.!cached syncβ Synchronize manually added mp3 files to thecacheddirectory.!uploadedβ Show uploaded video clips in theuploadeddirectory.!uploaded extractβ Extract mp3 files from video clips and store them in thecacheddirectory.
!registerβ Enable Melodix command listening (execute once for each new Discord server).!unregisterβ Disable command listening.melodix-prefixβ Show the current prefix (!by default, see.envfile).melodix-prefix-update "[new_prefix]"β Set a custom prefix (in quotes) for a guild to avoid collisions with other bots.melodix-prefix-resetβ Revert to the default prefix set in.envfile.
To use the play command, provide a YouTube video title, URL, or history ID:
!play Never Gonna Give You Up
!p https://www.youtube.com/watch?v=dQw4w9WgXcQ
!> 5 (assuming 5 is an ID from `!history`)
For adding a song to the queue, use:
!add Never Gonna Give You Up
!resume
To add Melodix to a Discord server, follow these steps:
- Create an application in the Discord Developer Portal and obtain the
APPLICATION_ID(in the General section). - In the Bot section, enable
PRESENCE INTENT,SERVER MEMBERS INTENT, andMESSAGE CONTENT INTENT. - Use the following link to authorize the bot:
discord.com/oauth2/authorize?client_id=YOUR_APPLICATION_ID&scope=bot&permissions=36727824- Replace
YOUR_APPLICATION_IDwith your Bot's Application ID from step 1.
- Replace
- Select a server and click "Authorize".
- Grant the necessary permissions for Melodix to function correctly (access to text and voice channels).
After adding the bot, build it from sources or download compiled binaries. Docker deployment instructions are available in docker/README.md.
This project is written in Go, so ensure your environment is ready. Use the provided scripts to build Melodix Player from sources:
bash-and-run.bat(or.shfor Linux): Build the debug version and execute.build-release.bat(or.shfor Linux): Build the release version.assemble-dist.bat: Build the release version and assemble it as a distribution package (Windows only).
Rename .env.example to .env and store your Discord Bot Token in the DISCORD_BOT_TOKEN variable. Install FFMPEG (only recent versions are supported). If using a portable FFMPEG, specify the path in DCA_FFMPEG_BINARY_PATH in the .env file.
For Docker deployment, refer to docker/README.md for specific instructions.
Melodix Player provides several API routes, subject to change.
GET /guild/ids: Retrieve active guild IDs.GET /guild/playing: Get info about the currently playing track in each active guild.
GET /history: Access the overall history of played tracks.GET /history/:guild_id: Fetch the history of played tracks for a specific guild.
GET /avatar: List available images in the avatar folder.GET /avatar/random: Fetch a random image from the avatar folder.
GET /log: Show the current log.GET /log/clear: Clear the log.GET /log/download: Download the log as a file.
For any questions, get support in the Official Discord server.
I drew inspiration from Muzikas, a user-friendly Discord bot by Fabijan Zulj.
Melodix is licensed under the MIT License.