All Projects → moonstar-x → Discord Music 24 7

moonstar-x / Discord Music 24 7

Licence: mit
A 24/7 music bot for Discord that pauses when nobody is listening.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Discord Music 24 7

Fs0c13ty Bot
🤖 A discord bot made to help you in moderation.
Stars: ✭ 24 (-38.46%)
Mutual labels:  discord-bot
Discord Bot
🤖 Our BIG help in things about moderation and many more useful stuff on our Discord server.
Stars: ✭ 30 (-23.08%)
Mutual labels:  discord-bot
Aurora Bot
A Multipurpose Discord Fun Bot!
Stars: ✭ 36 (-7.69%)
Mutual labels:  discord-bot
Discord Channel Moderator
Discord Moderation Bot that helps you restrict certain things such as commands, links.. in channels where they were not allowed. Script is Node.js based using discord.js
Stars: ✭ 27 (-30.77%)
Mutual labels:  discord-bot
Clinet
Official repository for Clinet, a Discord bot intended for assistance and control within your guilds.
Stars: ✭ 28 (-28.21%)
Mutual labels:  discord-bot
Ninjabotcore
C# Discord Bot Created Using .Net Core
Stars: ✭ 34 (-12.82%)
Mutual labels:  discord-bot
Supportboi
A support ticket Discord bot.
Stars: ✭ 22 (-43.59%)
Mutual labels:  discord-bot
Progress Bot
High-tech weaponized moe progress delivery bot for IRC, Discord, and web
Stars: ✭ 38 (-2.56%)
Mutual labels:  discord-bot
Pvpcraft
PvPCraft Discord bot
Stars: ✭ 29 (-25.64%)
Mutual labels:  discord-bot
Whatsapptodiscord
WhatsAppToDiscord is a Discord bot uses WhatsApp Web for messaging in Discord built on top of go-whatsapp and discordgo
Stars: ✭ 35 (-10.26%)
Mutual labels:  discord-bot
Automuteus
Discord Bot to automute Among Us players at round transitions, in conjunction with https://github.com/denverquane/amonguscapture
Stars: ✭ 852 (+2084.62%)
Mutual labels:  discord-bot
Event Bot
📣 Discord Bot to make announcements about upcoming sessions for the Fellows using Google Calendar and Calendly
Stars: ✭ 21 (-46.15%)
Mutual labels:  discord-bot
Cj
CJ is a Discord bot that hangs around in the open.mp/burgershot.gg community discord.
Stars: ✭ 34 (-12.82%)
Mutual labels:  discord-bot
Ai Doctor
Machine learning discord bot , Detects diseases within seconds with just an xray scan
Stars: ✭ 27 (-30.77%)
Mutual labels:  discord-bot
Discordspeechbot
A speech-to-text bot for discord with music commands and more using NodeJS. Ideally for controlling your Discord server using voice commands, can also be useful for hearing-impaired people.
Stars: ✭ 35 (-10.26%)
Mutual labels:  discord-bot
Satana
Satana is a free to use selfbot with premium features for nothing at all - no strings attached.
Stars: ✭ 24 (-38.46%)
Mutual labels:  discord-bot
Modmail
A feature rich discord Modmail bot
Stars: ✭ 957 (+2353.85%)
Mutual labels:  discord-bot
Tsukibot
Discord CryptoBot for Spot Prices
Stars: ✭ 38 (-2.56%)
Mutual labels:  discord-bot
Clara
A general purpose Node.JS bot for Discord.
Stars: ✭ 37 (-5.13%)
Mutual labels:  discord-bot
Discord4j
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.
Stars: ✭ 973 (+2394.87%)
Mutual labels:  discord-bot

discord trello ci-build-status open-issues-count docker-image-size docker-pulls

discord-music-24-7

A 24/7 music bot for Discord that pauses when nobody is listening.

Requirements

To self-host this bot, you'll need the following:

  • git
  • node.js (Version 12 or higher is required.)
  • ffmpeg
  • A C/C++ compiler installed (Required to install @discordjs/opus.)

ffmpeg should be installed by default on Linux and MacOS, in case it isn't, install it with your package manager.

For Windows users:

For ffmpeg, head over to ffmpeg's official website to download the binary which will need to be added to your $PATH. If you don't know how to add folders to your $PATH, check out this guide.

For C/C++ compiler, head over to Windows-Build-Tools on NPM and install the package globally.

Installation

In order to self-host this bot, first you'll need to clone this repository.

git clone https://github.com/moonstar-x/discord-music-24-7.git

Once cloned, proceed to install the dependencies:

npm install

Then, proceed to build the bot:

npm run build

Configuration

There are two ways to configure the bot, one with a settings.json file inside the config folder or with environment variables.

Here's a table with the available options you may configure:

Environment Variable JSON property Required Description
DISCORD_TOKEN discord_token Yes Your Discord bot's token.
PREFIX prefix No (Defaults to !) The prefix the bot will use for the commands.
OWNER_ID owner_id No The ID of the owner of the bot, mainly for owner-only commands. (None available yet.)
PRESENCE_TYPE presence_type No (Defaults to PLAYING) The presence type that will be used. Can only be one of: PLAYING, LISTENING, WATCHING or STREAMING.
CHANNEL_ID channel_id Yes The ID of the channel that will be auto joined by the bot.
SHUFFLE shuffle No (Defaults to true) Whether the bot should shuffle the queue on start-up.
PAUSE_ON_EMPTY pause_on_empty No (Defaults to true) Whether the bot should pause the music when the channel is empty.
CHANNEL_LEAVE_ON_EMPTY channel_leave_on_empty No (Defaults to false) Whether the bot should leave the channel when nobody is in it. (Not implemented yet!)
SOUNDCLOUD_CLIENT_ID soundcloud_client_id Only if queue contains a SoundCloud URL Your SoundCloud Client ID. To find your Client ID, check out this guide.
YOUTUBE_COOKIE youtube_cookie Preferable to use, will authenticate YouTube requests with your cookie. Tries to avoid the 429 Too Many Requests error. Your YouTube cookie. To find your YouTube cookie, check out this guide.
  • To see how to find the IDs for users or channels, you can check out this guide.
  • If you don't have a Discord token yet, you can see a guide on how to get one here.

Using the Config File

Inside the config folder you will see a file named settings.json.example, rename it to settings.json and replace all the properties with your own values.

Your file should look like this:

{
  "discord_token": "YOUR DISCORD TOKEN",
  "prefix": "!",
  "owner_id": "YOUR USER ID (IF YOU'RE THE OWNER)",
  "presence_type": "PLAYING",
  "channel_id": "THE CHANNEL ID OF THE CHANNEL THAT WILL BE USED BY THE BOT",
  "shuffle": true,
  "pause_on_empty": true,
  "channel_leave_on_empty": false,
  "soundcloud_client_id": "YOUR SOUNDCLOUD ID IF NEEDED",
  "youtube_cookie": "YOUR YOUTUBE COOKIE IF NEEDED"
}

Usage

You can start the bot by running:

npm start

The bot will automatically start playing music in the configured channel, it will also automatically pause when nobody is listening to the music to save bandwidth (if pause_on_empty or PAUSE_ON_EMPTY enabled).

This bot is designed to work only on one server at a time. Inviting your bot to multiple servers will yield unexpected behavior.

The music that is played is stored in the queue.txt inside the data folder. You can add the music you want the bot to play in this file. Any links must begin with https:// or http://.

Additionally, you can play local music by inserting .mp3 or .m4a files inside the data/local-music folder. Make sure the files are properly ID3 tagged so the bot can get the artist and song name from the metadata.

Supported URLs

The bot can play music from the following URLs:

  • youtube.com
  • youtu.be
  • soundcloud.com

Playlists are not officially supported yet. You may find that they may work but generally only the first song will be pulled from them.

Getting 429 Too Many Requests

If you're reaching 429: Too Many Requests errors in the console, then most likely you're being rate limited by YouTube because your connection is not authenticated.

Inside Configuration you'll find a parameter called youtube_cookie, this is where you'll paste the cookie extracted from your YouTube login.

  1. Head over to YouTube and login if you haven't already.
  2. Then, open the developer inspector (Ctrl+Shift+I or Cmd+Option+I) and open the Network tab. Refresh the page if you're not getting a list of requests. (Make sure to select All* in the filter tab).
  3. Look for a request named www.youtube.com and check it's headers. Under Response Headers you will find the header set-cookie, this will contain a directive called expires, keep this date in mind because your cookie will be invalidated after this date and you may need to update the settings file manually prior to this date. (Currently looking for a way to avoid this.)
  4. Inside the same request, look for the Request Headers and copy the content of the cookie header. This is the cookie that you'll need to paste inside the settings.json file or set as your YOUTUBE_COOKIE environment variable.

Repl.it Support

Unfortunately, Repl.it does not support ffmpeg anymore which means that this bot will not work on this.

Docker Support

You can use the bot through Docker.

Volumes

You may use the following volumes:

Volume Description
/opt/app/config Volume where the config file is located. Generally not necessary since you can configure the bot with environment variables.
/opt/app/data Volume where the data folder is located. Here you can find the queue.txt file and the local-music folder.

Environment Variables

You can configure the bot using environment variables. To do so, check out configuration for a full list of what environment variables are used.

Starting the Container

Starting the bot's container can be done by running:

docker run -it -e DISCORD_TOKEN="YOUR DISCORD TOKEN" -e CHANNEL_ID="YOUR CHANNEL ID" -v "/local/folder/for/data":"/opt/app/data" moonstarx/discord-music-24-7:latest

Author

This bot was made by moonstar-x with contributions from zackradisic (Soundcloud support).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].