Music

This Cog contains the bot’s music-playing commands.

Hint

To enable this cog, set the ENABLE_MUSIC variable.

Packages

  • yt-dlp is used to download music from Youtube.

  • It uses FFmpeg to extract the audio. Install instructions can be found at ffmpeg.org.

New in version 1.1.0: The yt-dlp package.

Deprecated since version 1.1.0: The use of the youtube-dl package in this bot is deprecated. Backwards compatibility is maintained but installing yt-dlp is recommended.

Changed in version 3.0.0: The youtube-dl package is no longer used, please install yt-dlp instead.

env variables

Name

Description

MUSIC_DIR

Where to download the songs

MAX_DURATION

Maximum length a song can have to be played, see How it works

New in version 3.0.0: config.py creates the MUSIC_DIR directory.

How it works

Videos are downloaded with yt-dlp and the audio is extracted with FFmpeg. This means that the songs take space in your drive and may take some time before being playable, depending on your network speed.

To avoid downloading really long songs and taking ages to begin playback, the MAX_DURATION variable was added to limit the length of the songs.

Also note that the downloads folder is not cleaned at all: the songs have to be deleted manually, but if the bot has to play a song it already downloaded, it will be able to do so faster than when the song was first requested.