-
hi if i play thi song https://www.youtube.com/watch?v=fupL7GLEuCE the bot block and doesn't respond at new command, the bot enter in voice channel but doesn't play the music and if a play another song the bot doesn't respond at my commmand, only thing i can do is restart the bot with node . What can i do for solve this problem? this is my code: const discord = require('discord.js'); const { EmbedBuilder } = require('discord.js'); const { SpotifyPlugin } = require("@distube/spotify") const { SoundCloudPlugin } = require("@distube/soundcloud") const { YtDlpPlugin } = require("@distube/yt-dlp"); const { DisTube } = require('distube'); const { ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js'); const client = new discord.Client({ intents: [ discord.GatewayIntentBits.Guilds, discord.GatewayIntentBits.GuildMessages, discord.GatewayIntentBits.GuildVoiceStates, discord.GatewayIntentBits.MessageContent ] }); const distube = new DisTube(client, { leaveOnStop: false, leaveOnEmpty: true, emitNewSongOnly: true, emitAddSongWhenCreatingQueue: false, emitAddListWhenCreatingQueue: false, plugins: [new SpotifyPlugin(), new SoundCloudPlugin(), new YtDlpPlugin()] }); client.once('ready', () => { console.log( client.user.setActivity('𝐼𝒩𝒮𝒰𝐿𝒯𝒜𝑅𝐸 𝒮𝒫𝒜𝑅𝒜𝒞𝐼𝒩𝒪 𝒮𝒞𝑅𝐼𝒱𝐼 -𝓈𝓅𝒶𝓇𝒶𝒸𝒾𝓃𝑜 𝒫𝐸𝑅 𝒰𝐿𝒯𝐸𝑅𝐼𝒪𝑅𝐼 𝒟𝐸𝒯𝒯𝒜𝒢𝐿𝐼'); }); const config = { prefix: '-', token: 'TOKEN', }; client.on("messageCreate", async (message) => { if (message.author.bot || !message.inGuild()) return; if (message.mentions.has(client.user)){ const embed = new EmbedBuilder() .setDescription('Che cazzo vuoi coglione di merda il mio prefisso è return message.channel.send({ embeds: [embed] }); } if (!message.content.startsWith(config.prefix)) return; const args = message.content .slice(config.prefix.length) .trim() .split(/ +/g); const command = args.shift(); if (command === 'play' || command === 'p') { const voiceChannel = message.member.voice.channel; if (!voiceChannel) return message.channel.send('Devi essere in un canale vocale per utilizzare questo comando.'); const songQuery = args.join(' '); if (!songQuery) return message.channel.send('Devi specificare una canzone o un URL valido.'); try { await distube.play(message.member.voice.channel, songQuery, { member: message.member, textChannel: message.channel, message: message }); } catch (error) { console.error(error); message.channel.send('❌ Si è verificato un errore durante la riproduzione'); } } else if (command === 'skip' || command === 's') { const queue = distube.getQueue(message); if (!queue) return message.channel.send('🚫 La coda è vuota'); if (queue.songs.length <= 1){ message.channel.send('🚫 Non c'è nulla in coda per saltare'); } else{ try{ await distube.skip(message); message.channel.send('⏭ Saltata la canzone attuale'); } catch(error){ console.error(error);} } } else if (command === 'stop') { const queue = distube.getQueue(message); if (!queue) return message.channel.send('🚫 La coda è vuota'); try{ await distube.stop(message); message.channel.send('🛑 La canzone è stata interrotta'); } catch(error){ console.error(error);} } else if (command === 'restart') { const queue = distube.getQueue(message); if (!queue) return message.channel.send('🚫 La coda è vuota'); try{ await distube.seek(message, 0); message.channel.send('🛑 La canzone è ricominciata'); } catch(error){ console.error(error);} } else if (command === 'resume'|| command === 'r') { const queue = distube.getQueue(message); if (!queue) return message.channel.send('🚫 La coda è vuota'); try{await distube.resume(message); message.channel.send(' } catch(error){ console.error(error);} } else if (command === 'pause') { const queue = distube.getQueue(message); if (!queue) return message.channel.send('🚫La coda è vuota'); try{await distube.pause(message); message.channel.send('⏸️ La canzone è stata messa in pausa'); } catch(error){ console.error(error);} } else if (command === 'sparacino') { const button= new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId('button') .setLabel('CLICCAMI') .setStyle(ButtonStyle.Success) ) const embed = new EmbedBuilder() .setTitle('SPARACINO È UNA 💩💩') .setDescription('SE VUOI VEDERLO CLICCA IL PULSANTE') .setImage('https://i.imgur.com/frb7mz8.jpg') const embed2 = new EmbedBuilder() .setTitle('ECCOLO QUI') .setImage('https://i.imgur.com/lGQFqLm.png'); message.channel.send({ embeds: [embed], components: [button] }); const collector = message.channel.createMessageComponentCollector({ max: '1', time: '60000', }); collector.on('collect',async i =>{ try {await i.update({ embeds: [embed2], components: []})} catch(error){ console.error(error);} }) } else if (command === 'ping'){ const embed = new EmbedBuilder() .setDescription('Pong') .setColor('#0099ff') message.channel.send({ embeds: [embed] }); } else if (command === 'racism'){ const embed = new EmbedBuilder() .setImage('https://cdn.discordapp.com/attachments/972954024905175061/1084606665510359140/received_547985302928296_1.gif') message.channel.send({ embeds: [embed] }); } else if (command === 'help') { const embed = new EmbedBuilder() .addFields({name:'DJ commands', value : ' .setColor('#0099ff') message.channel.send({ embeds: [embed] }); } if (['repeat', 'loop'].includes(command)) { const queue = distube.getQueue(message); if (!queue) return message.channel.send('🚫La coda è vuota'); try{ const mode = distube.setRepeatMode(message); await message.channel.send(
mode ? mode === 2 ? 'All Queue' : 'This Song' : 'Off' }``, ); } catch(error){ console.error(error);} } }); distube.on("playSong", (queue, song) => { const embed = new EmbedBuilder() .setTitle('🎶 Riproducendo') .addFields({name:'Canzone', value : song.name }) .addFields({name:'Durata', value : song.formattedDuration }) .setColor('#0099ff') .setThumbnail(song.thumbnail) queue.textChannel.send({ embeds: [embed] }); }); distube.on('addSong', (queue, song) => { const embed = new EmbedBuilder() .setTitle('Aggiunta canzone') .addFields({name:'Canzone', value : song.name }) .setColor('#0099ff') .setThumbnail(song.thumbnail) queue.textChannel.send({ embeds: [embed] }); }); client.login(config.token); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Does your bot not give any error messages? This kind of thing happened with my bot. I went to the node_modules/@distube/ytdl-core/lib/info.js file and i commented the code:
This code adds some specific information for some videos that ends up breaking the playback of songs. This worked for me and I couldn't find another way to solve it. I also recommend doing error handling on your bot so that it doesn't stop working when errors occur. This text was written with Google Translate. |
Beta Was this translation helpful? Give feedback.
-
Update your |
Beta Was this translation helpful? Give feedback.
Update your
@distube/ytdl-core
to4.11.10