From ab5f546939fe3ec327dd05e83fd70bfa00661c02 Mon Sep 17 00:00:00 2001 From: landerf Date: Fri, 2 Jun 2023 02:31:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20HOTFIX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/discord/client/ready.js | 250 ++++++++++++++++------------- 1 file changed, 139 insertions(+), 111 deletions(-) diff --git a/src/events/discord/client/ready.js b/src/events/discord/client/ready.js index 48d4641dc..c4b48b4eb 100644 --- a/src/events/discord/client/ready.js +++ b/src/events/discord/client/ready.js @@ -53,118 +53,146 @@ module.exports = { : "Off" }\` \n Autoplay: \`${queue.autoplay ? "On" : "Off"}\``; client.distube - .on("playSong", (queue, song) => - queue.textChannel.send({ - embeds: [ - new EmbedBuilder() - .setColor("Green") - .setDescription( - `đŸŽ¶ | Lecture de \`${song.name}\` - \`${song.formattedDuration}\`` - ) - .addFields([ - { - name: `Infos :`, - value: `${status(queue)}`, - inline: true, - }, - { - name: `DemandĂ© par :`, - value: `${song.user}`, - inline: true, - }, - ]) - .setFooter({ - text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, - }), - ], - }) - ) - .on("addSong", (queue, song) => - queue.textChannel.send({ - embeds: [ - new EmbedBuilder() - .setColor("Green") - .setDescription( - `đŸŽ¶ | Ajout de ${song.name} - \`${song.formattedDuration}\`` - ) - .addFields([ - { - name: `DemandĂ© par :`, - value: `${song.user}`, - inline: true, - }, - ]) - .setFooter({ - text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, - }), - ], - }) - ) - .on("addList", (queue, playlist) => - queue.textChannel.send({ - embeds: [ - new EmbedBuilder() - .setColor("Green") - .setDescription( - `đŸŽ¶ | Ajout de la playlist \`${playlist.name}\` (${playlist.songs.length} musiques) Ă  la liste de lecture` - ) - .addFields([ - { - name: `Infos`, - value: `${status(queue)}`, - inline: true, - }, - ]) - .setFooter({ - text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, - }), - ], - }) - ) + .on("playSong", (queue, song) => { + try { + queue.textChannel.send({ + embeds: [ + new EmbedBuilder() + .setColor("Green") + .setDescription( + `đŸŽ¶ | Lecture de \`${song.name}\` - \`${song.formattedDuration}\`` + ) + .addFields([ + { + name: `Infos :`, + value: `${status(queue)}`, + inline: true, + }, + { + name: `DemandĂ© par :`, + value: `${song.user}`, + inline: true, + }, + ]) + .setFooter({ + text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, + }), + ], + }); + } catch (e) { + console.log(e); + } + }) + .on("addSong", (queue, song) => { + try { + queue.textChannel.send({ + embeds: [ + new EmbedBuilder() + .setColor("Green") + .setDescription( + `đŸŽ¶ | Ajout de ${song.name} - \`${song.formattedDuration}\`` + ) + .addFields([ + { + name: `DemandĂ© par :`, + value: `${song.user}`, + inline: true, + }, + ]) + .setFooter({ + text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, + }), + ], + }); + } catch (e) { + console.log(e); + } + }) + .on("addList", (queue, playlist) => { + try { + queue.textChannel.send({ + embeds: [ + new EmbedBuilder() + .setColor("Green") + .setDescription( + `đŸŽ¶ | Ajout de la playlist \`${playlist.name}\` (${playlist.songs.length} musiques) Ă  la liste de lecture` + ) + .addFields([ + { + name: `Infos`, + value: `${status(queue)}`, + inline: true, + }, + ]) + .setFooter({ + text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, + }), + ], + }); + } catch (e) { + console.log(e); + } + }) .on("error", (channel, e) => { - if (channel) - channel.send( - `⛔ | An error encountered: ${e.toString().slice(0, 1974)}` - ); - else console.error(e); + try { + if (channel) + channel.send( + `⛔ | An error encountered: ${e.toString().slice(0, 1974)}` + ); + else console.error(e); + } catch (e) { + console.error(e); + } + }) + .on("empty", (queue) => { + try { + queue.textChannel.send({ + embeds: [ + new EmbedBuilder() + .setColor("Red") + .setDescription( + "⛔ | Je me sens seul.e dans le salon vocal, je quitte le salon vocal..." + ) + .setFooter({ + text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, + }), + ], + }); + } catch (e) { + console.log(e); + } + }) + .on("searchNoResult", (message, query) => { + try { + message.channel.send({ + embeds: [ + new EmbedBuilder() + .setColor("Red") + .setDescription(`⛔ | Aucun rĂ©sultat trouvĂ© pour : ${query}!`) + .setFooter({ + text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, + }), + ], + }); + } catch (e) { + console.log(e); + } }) - .on("empty", (channel) => - channel.send({ - embeds: [ - new EmbedBuilder() - .setColor("Red") - .setDescription( - "⛔ | Je me sens seul.e dans le salon vocal, je quitte le salon vocal..." - ) - .setFooter({ - text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, - }), - ], - }) - ) - .on("searchNoResult", (message, query) => - message.channel.send({ - embeds: [ - new EmbedBuilder() - .setColor("Red") - .setDescription(`⛔ | Aucun rĂ©sultat trouvĂ© pour : ${query}!`) - .setFooter({ - text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, - }), - ], - }) - ) - .on("finish", (queue) => - queue.textChannel.send({ - embeds: [ - new EmbedBuilder() - .setColor("Green") - .setDescription("🏁 | Liste de lecture terminĂ©e!") - .setFooter({ - text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, - }), - ], - }) - ); + .on("finish", (queue) => { + try { + queue.textChannel.send({ + embeds: [ + new EmbedBuilder() + .setColor("Green") + .setDescription("🏁 | Liste de lecture terminĂ©e!") + .setFooter({ + text: `Powered by Distube \nUpdated by Doc_Landerf \n© Doc_Landerf all rights reserved`, + }), + ], + }); + } catch (e) { + console.log(e); + } + }); }, };