Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

450
Views
Can discord bot able to play a youtube video/audio (ytdl) around 22 hours?

Well the code below works fine but the only problem is the bot do not play the full track, so is it even possible to play many hours like 22 hours? any ideas?

I hope I did a great job explaining the problem

node v12.22.10

discord.js v12.5.3


command file test.js:

const ytdl = require('ytdl-core');
const Discord = require('discord.js')
const client = new Discord.Client()
module.exports = {
    commands: 'test',
    callback: (message, arguments, text, client) => {

        const url = 'url here';

        if (message.content == '!test') {
            if (!message.member.voice.channel) return message.reply("you need to be on a voice channel to play the audio");
            message.member.voice.channel.join().then(VoiceConnection => {
                VoiceConnection.play(ytdl(url)).on("finish", () =>
                    VoiceConnection.disconnect());

                const logo =
                    'url here'
                const thumb = 'url here'

                const embed = new Discord.MessageEmbed()
                    .setTitle('Playing...')
                    .setAuthor(message.author.username)
                    .setTimestamp()
                    .setThumbnail(thumb)
                    .setFooter("xx", logo)
                    .setColor('#447a88')




                message.reply(embed)
            }).catch(e => console.log(e))

        }
    }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!