Code Monkey home page Code Monkey logo

music-bot's Introduction

Music-bot

A complete code to download for a music bot 🎧

Looking for a code for a music bot? This fully open-source code is made for your project!

If you need help with this project, to get support faster you can join the help server by just clicking here.

If you don't have any development knowledge, it is recommended to join the Discord support server to get help.

⚡ Configuration

Open the configuration file located in the main folder config.js.

module.exports = {
    app: {
        token: 'XXX',
        playing: 'by Zerio ❤️',
        global: true,
        guild: 'xxx',
        ExtraMessages: false,
        loopMessage: false,
},
    opt: {
        DJ: {
            enabled: false,
            roleName: '',
            commands: []
        },
        maxVol: 100,
        spotifyBridge: true,
        volume: 75,
        leaveOnEmpty: true,
        leaveOnEmptyCooldown: 60000,
        leaveOnEnd: true,
        leaveOnEndCooldown: 60000,
        discordPlayer: {
            ytdlOptions: {
                quality: 'highestaudio',
                highWaterMark: 1 << 25
            }
        }
    }
};

Basic configuration

  • app/token, the token of the bot available on the Discord Developers section
  • app/playing, the activity of the bot
  • app/global, whether the commands will work on all servers or just one (if global they might take up to an hour to show up)
  • app/guild, the guild the slash command will be loaded to (this only applys if global is set to false)
  • app/ExtraMessages will increesse the amount of bot spam, while you get more infomation (not recommended)
  • opt/loopMessage, if the message that a music is played should be sent when it is looped

DJ mode configuration

  • opt/DJ/enabled, whether the DJ mode should be activated or not
  • opt/DJ/roleName, the name of the DJ role to be used
  • opt/DJ/commands, the list of commands limited to members with the DJ role

Advanced configuration (only change if you know what you are doing)

  • opt/maxVol, the maximum volume that users can define
  • opt/spotifyBridge, takes spotify songs/playlists and searches it on youtube and plays it (highly recommended)
  • opt/volume, is the defaul volume the queue will start at
  • opt/leaveOnEmpty, if the bot will leave when the queue is empty
  • opt/leaveOnEmptyCooldown, the cooldown before the bot leaves when the queue is empty
  • opt/leaveOnEnd, if the bot will leave on finishing the queue
  • opt/leaveOnEndCooldown, the cooldown before the bot leaves on finishing the queue
  • opt/discordPlayer, options used by discord-player

📑 Installation

To use the project correctly you will need some tools.

WARNING: You MUST use Node.js version under 18.17, otherwise, you will encounter major compatibility issues.

FFmpeg to process audio

Node JS (v18.17) or older for environment

yarn for package management

Without forgetting of course the code editor, we recommend visual studio code

Now in your terminal run the following commands assuming you are in the same directory as the project.

yarn install (or npm install not recommended as it might not work)

node . (or node index.js)

and Done, your bot should be running!

Realized with ❤️ by ZerioDev.

Please do not withdraw the license and keep the credits on this project.

To have full access to the project and to be able to withdraw the credits a small donation is accepted.

📝 ToDo

  • Vote to skip command #187

music-bot's People

Contributors

alphaegen avatar androz2091 avatar bananinbanano avatar chemical-tourist-18 avatar igamecreep avatar johannes7k75 avatar nickeldon avatar nikki-devil avatar revot334 avatar swarwerth avatar tonyg433 avatar y0rune avatar zeriodev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

music-bot's Issues

Question Lancement Musique

Hey !
Quand je lance une musique, tout va bien mais un petit message apparaît dans la console et je sais pas trop comment l'enlever...

Le voici:
image

Vous avez une solution ?

DiscordAPIError: Invalid Form Body

The queue cant handle more than 2000 letters because the DiscordAPI or also the user can't send more than 2000 letters in any channel. so it will be better if you used an embed with pages to using the react to show the other page.

Error: content: Must be 2000 or fewer in length.

I did everything clearly according to the instructions The bot simply enters the voice channel and nothing else happens

    at Function.getInfo (D:\discord\Music-bot-master\node_modules\prism-media\src\core\FFmpeg.js:142:11)
    at Function.create (D:\discord\Music-bot-master\node_modules\prism-media\src\core\FFmpeg.js:155:38)
    at new FFmpeg (D:\discord\Music-bot-master\node_modules\prism-media\src\core\FFmpeg.js:44:27)
    at StreamDownloader (D:\discord\Music-bot-master\node_modules\discord-ytdl-core\index.js:45:24)
    at Promise (D:\discord\Music-bot-master\node_modules\discord-player\src\Player.js:681:31)
    at new Promise (<anonymous>)
    at Player._playYTDLStream (D:\discord\Music-bot-master\node_modules\discord-player\src\Player.js:667:16)
    at Player._playTrack (D:\discord\Music-bot-master\node_modules\discord-player\src\Player.js:747:14)
    at channel.join.then (D:\discord\Music-bot-master\node_modules\discord-player\src\Player.js:300:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2504) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2504) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Problème Commande Volume

Bonjour, j'ai un problème avec la commande volume, le code c'est le même qui a dans le fichier command sauf que quand je fais : +volume 50 Il me répond : "Please Enter a valid number"

It's aren't working

Hai the code is giving error /
/

  • validateURL will be renamed to validateID to match with getPlaylistID in the next release of ytpl *
  •               set ytpl.do_warn_deprecate = false to disable this message                    *
    

Can u help us. I tried your discord but it's not working
Can u contact me plz SoulStonePlays#6388

Bug commande volume

On peut faire la commande !play Infinity,
Il faudrait patch sa pour les autres ! 😁

Crash Filtre Superequalizer

Bonjour, quand je lance une musique et que j'y ajoute le filtre Superequalizer, le bot crash instant.

Voici l'erreur :
image

Sauriez-vous m'aidé svp ?

Bot is working ;)

BTW If I may ask you to add if bot is installed it required to installed ffmpeg in the system or adding it into the node-packges or something ;)

Thank you 👍

Commande Queue + erreur console

Bonjour, voici la commande queue en version Embed, quand je fais la commande, rien ne se passe :/

image

Ensuite, j'ai cette erreur dans la console et je sais pas de quelle commande ça vient :

image

Bug Fix

Command: Clear Queue
If you have less than one song in the queue, and executing the command, it will generate an error, to fix it just add the following line:

let trackList = queue.tracks.length;
if(trackList <= 1) return message.channel.send(`${client.emotes.error} - There is only one song in the queue.`);

Need to add before the clear queue function.

Greetings.

choose music

how to make the song play automatically by name, without having to choose in the text channel which song you want to hear?

Error: TypeError: Cannot read property 'find' of undefined when using the filter command

Steps to reproduce:

  1. {prefix}play love (or any other title/url)
  2. {prefix}filter nightcore (or any other filter)
  3. Bot instance crashes and prints the following error into the console:

TypeError: Cannot read property 'find' of undefined at Object.execute (C:\Users\lutzl\Desktop\otis2\commands\music\filter.js:16:47) at module.exports (C:\Users\lutzl\Desktop\otis2\events\message.js:13:18) at Client.emit (node:events:376:20) at MessageCreateAction.handle (C:\Users\lutzl\Desktop\otis2\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\lutzl\Desktop\otis2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\lutzl\Desktop\otis2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31) at WebSocketShard.onPacket (C:\Users\lutzl\Desktop\otis2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22) at WebSocketShard.onMessage (C:\Users\lutzl\Desktop\otis2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) at WebSocket.onMessage (C:\Users\lutzl\Desktop\otis2\node_modules\ws\lib\event-target.js:132:16) at WebSocket.emit (node:events:376:20)

The mentioned line of filter.js is const filterToUpdate = client.filters.find((x) => x.toLowerCase() === args[0].toLowerCase());.

Bot is just broken

When you say the prefix and play and then play anything doesn't matter what the bot just doesn't do anything, extremely useless especially when it doesn't even log the error.

DJ role

As the title says a DJ role along with a vote skip for people with non-DJ role would be a good addition.

Error

When I try to join the voice channel with the play command, an error appears. Error:

(node:12900) UnhandledPromiseRejectionWarning: TypeError: command.run is not a function
at Client. (C:\Users\user\Desktop\Thunder Music\index.js:44:17)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\user\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\user\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\user\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\user\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\user\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\user\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\user\node_modules\ws\lib\websocket.js:825:20)
(Use node --trace-warnings ... to show where the warning was created)
(node:12900) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12900) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

error

UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
at Function.getInfo (C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\prism-media\src\core\FFmpeg.js:142:11)
at Function.create (C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\prism-media\src\core\FFmpeg.js:155:38)
at new FFmpeg (C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\prism-media\src\core\FFmpeg.js:44:27)
at StreamDownloader (C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\discord-ytdl-core\index.js:45:24)
at C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\discord-player\src\Player.js:681:31
at new Promise ()
at Player._playYTDLStream (C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\discord-player\src\Player.js:667:16)
at Player._playTrack (C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\discord-player\src\Player.js:747:14)
at C:\Users\Acer\Desktop\muzikbotu deneme\node_modules\discord-player\src\Player.js:300:22
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:9152) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:9152) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Clear Queue Sans Erreur Console

La Commande Clear-Queue s'éxécute, mais ça supprime pas la queue il a aucune erreur dans la console. C'est le même code que dans le fichier commands.

a

(node:2656) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users\Windows 10\Desktop\Music-bot-master\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:26)
at Client.login (C:\Users\Windows 10\Desktop\Music-bot-master\node_modules\discord.js\src\client\Client.js:223:21)
(node:2656) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2656) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS C:\Users\Windows 10\Desktop\Music-bot-master>

play command error

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'createMessageCollector' of undefined
at /home/runner/Music-bot/node_modules/discord-player/src/Player.js:178:47
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:192) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:192) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error

(node:10636) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 closing listeners added to [VoiceConnection]. Use emitter.setMaxListeners() to increase limit

how to fix it

Problem with dependency

I tried to create a PR but after cloning that repo I have problem with dependency .
If the problem can somebody resolve please help me with. After that I can add the ffmpeg-static into package.json.

yorune@Gentoo ~/git/Music-bot Ffmpeg-into-package $ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @discordjs/[email protected]
npm ERR! node_modules/@discordjs/opus
npm ERR!   @discordjs/opus@"^0.3.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @discordjs/opus@"^0.1.0" from [email protected]
npm ERR! node_modules/prism-media
npm ERR!   prism-media@"^1.2.2" from [email protected]
npm ERR!   node_modules/discord.js
npm ERR!     discord.js@"^12.2.0" from the root project
npm ERR!   prism-media@"^1.2.2" from [email protected]
npm ERR!   node_modules/discord-ytdl-core
npm ERR!     discord-ytdl-core@"^5.0.0" from [email protected]
npm ERR!     node_modules/discord-player
npm ERR!       discord-player@"^3.0.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/yorune/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/yorune/.npm/_logs/2020-12-01T22_26_41_696Z-debug.log

Add command usage!

Can you please add command method on how to type the command because it's not working for me everytime I try to play any song it cause error.

I can't download the node modules!

i am getting this error

npm ERR! Linux 3.10.0-1127.8.2.vz7.158.8
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! @discordjs/[email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @discordjs/[email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the @discordjs/opus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs @discordjs/opus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls @discordjs/opus
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/Music-bot/npm-debug.log

Erreur Now-playing

Quand on essaie de faire la commande alors que aucune musique n'est jouée, le bot crash et ça met cette erreur :

image

play command error

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'createMessageCollector' of undefined
at /home/runner/Music-bot/node_modules/discord-player/src/Player.js:178:47
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:192) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:192) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.