Make Your Own Discord Bot | Music Bot (Play, Skip, Stop Commands)

Alesh the Dev · 425K views · 2019 · 25:48

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they followed (or recommend) for building a discord.js music bot, often when asking about errors or extending the queue code from the video.

Recommended by 2 people across 2 different months, 2020 to 2021.

What it is

A 25-minute tutorial by Alesh the Dev (shown on the CodeLyon channel) that builds a Discord music bot with discord.js and Node.js. It implements play, skip and stop commands using a song queue and ytdl-core, and builds on earlier videos in the series covering FFmpeg and basic bot commands.

What people said

Recommends Joel Youngberg · 2021-01 · Stack Overflow · on “discord.js not playing audio file”

Just wanted to mention that for me neoney's answer worked, but it threw an error on connection.playFile, what finally ended up working for me was: const dispatcher = connection.play(require("path").join(__dirname, './myfile.mp3')); Note that you can also use (__dirname, ' ../myFolderName /myfile.mp3') in the parenthesis to go out of the current folder and play from within another named folder up one directory. For more detail on the complete setup, there is a decent video/channel here by CodeLyon: [this video]

Recommends Molecraft HD · 2021-07 · Stack Overflow · on “Cannot read property 'queue' of undefined Discord Music bot”

So i want to write a Music bot for discord using discord.js its one of my first javascript projects and i followed this tutorial [this video] but all i is this error message: TypeError: Cannot read property 'queue' of undefined const { Client, Attachment } = require('discord.js'); const bot = new Client(); const ytdl = require("ytdl-core"); const token = ''; const PREFIX = '!'; const servers = {}; bot.on('ready', () =>{ console.log('This bot is online!'); }) bot.on('message', message=>{ let args = message.content.substring(PREFIX.length).split(" "); switch(args[0]){ case 'play': function play(connection, message){ var server = servers[message.guild.id]; server.dispatcher = connection.play(ytdl(se

Cites David Lee · 2020-12 · Stack Overflow · on “Discord.js Music Bot: How do I make one command that adds a whole playlist of songs into the queue”

I'm on Windows 10 and using Node.js I used this YouTube video to get most of the code ( [this video] ). After watching the video, I wanted to add a few commands on my own, so using the code from the video I made the "christmas" command, where I can add a ton of songs to the queue without having to input the command one by one. The command works well, but my problem is that if I try to add another song onto the queue using the "play" command, it just ignores the play command and stops at the end of the christmas queue. So my question is, is there a better way to write my "christmas" command? [Code] const Discord = require("discord.js"); const client = new Discord.Client(); const ytdl = require("yt