Melodix Player is my pet project that plays audio from YouTube and audio streaming links to Discord voice channels.
You can test Melodix in two ways:
.env
config file). Follow the "Create bot in Discord Developer Portal" section to set up the bot in Discord.#bot-spam
channels.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 .env
file.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 (from cached
directory). Each server operates its own files.!cached sync
β Synchronize manually added mp3 files to the cached
directory.!uploaded
β Show uploaded video clips in the uploaded
directory.!uploaded extract
β Extract mp3 files from video clips and store them in the cached
directory.!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 .env
file).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 .env
file.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:
APPLICATION_ID
(in the General section).PRESENCE INTENT
, SERVER MEMBERS INTENT
, and MESSAGE CONTENT INTENT
.discord.com/oauth2/authorize?client_id=YOUR_APPLICATION_ID&scope=bot&permissions=36727824
YOUR_APPLICATION_ID
with your Bot's Application ID from step 1.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 .sh
for Linux): Build the debug version and execute.build-release.bat
(or .sh
for 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.