From 471dc1816634049de862cc5d027741707a4ec5cd Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 12:20:43 +0100 Subject: [PATCH 1/9] fixed a bug where no music play on the first call --- src/Commands/music/play.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Commands/music/play.js b/src/Commands/music/play.js index a103f24..2cefbc1 100644 --- a/src/Commands/music/play.js +++ b/src/Commands/music/play.js @@ -32,6 +32,14 @@ module.exports = { .setDescription("⏳ Searching ...") ] }) + + var channel = message.member.voice.channel; + await joinVoiceChannel({ + channelId: channel.id, + guildId: message.guild.id, + adapterCreator: message.guild.voiceAdapterCreator + }) + if (music.startsWith('http')) { try{ await client.distube.playVoiceChannel(channel, music, {options: message.user}) @@ -44,8 +52,6 @@ module.exports = { message.editReply({ embeds: [errorEmbed().setDescription(`${e}`)], ephemeral: true }) } - - } else { try { YTBsearch = await client.distube.search(music) From 04f6886022335ee06ff316c1cece4758d02f02f6 Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 13:52:24 +0100 Subject: [PATCH 2/9] Shrex ? --- src/Commands/Fun/shrex.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Commands/Fun/shrex.js diff --git a/src/Commands/Fun/shrex.js b/src/Commands/Fun/shrex.js new file mode 100644 index 0000000..d956b03 --- /dev/null +++ b/src/Commands/Fun/shrex.js @@ -0,0 +1,24 @@ +const { errorEmbed, musicEmbed} = require("../../util/Embeds") + + + +function codeblock(code) { + return `\`\`\`${code}\`\`\``; +} + + +module.exports = { + + name: "shrex", + description: "Display Shrex in chat", + permission: "ADMINISTRATOR", + active: true, + + async execute(message, client) { + try{ + message.reply(codeblock("⣿⣿⣿⣿⠋⢩⢹⣿⣿⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⡧⣦⠄⢧⡙⢿⣟⢁⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⢿\n⣿⣿⣿⣷⣶⣶⣦⡈⠂⠄⠸⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠉⠰⢠⣼\n⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⢒⣂⠄⠙⢿⣿⣿⡿⠛⢛⣻⣿⣿⡟⢁⣠⣴⣶⣶\n⣿⣿⣿⣿⣿⣿⣿⠇⢇⡄⣆⣤⣀⣦⡄⢈⣉⣛⣭⡀⠙⠭⡛⠿⣿⣻⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⠄⠄⣿⣿⣿⣿⣿⢃⣿⣿⣿⣿⣿⣶⣷⡾⣼⣿⠈⠉⠄⠄⠈\n⣿⣿⣿⣿⣿⣿⡇⠄⠄⢿⣿⣿⣿⣥⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠄⠄⠄⠄\n⣿⣿⣿⣿⡿⠋⠄⠄⠄⢸⣿⡿⠿⠄⠈⠛⢟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠄⠄⠄\n⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⢠⣄⣀⡲⢦⣤⣼⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⠄\n⠛⠋⠄⠄⠄⠄⠄⠄⠄⠄⠈⢿⣟⠻⠿⣿⣿⣿⣷⣾⣿⣿⣿⣿⢿⣿⣿⡇⠄⠄\n⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠻⣷⣶⣾⣿⣿⣿⣿⣿⣿⠟⢡⣿⣿⣿⡟⠄⠄\n⣦⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣉⣹⣿⣿⣿⣿⠟⠁⣰⣿⣿⣿⣿⡇⠄⠄\n⣿⣧⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠉⠉⠙⠛⠉⠁⢀⣼⣿⣿⣿⣿⡟⠄⠄⠄")) + } catch (e) { + message.reply({ embeds: [errorEmbed().setDescription(`${e}`)], ephemeral: true }) + } + } +} From 5d68dafa0ed453ab3a4e4588e85341275d5fd2ed Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 14:02:38 +0100 Subject: [PATCH 3/9] forgot require --- src/Commands/music/play.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Commands/music/play.js b/src/Commands/music/play.js index 2cefbc1..01b7b06 100644 --- a/src/Commands/music/play.js +++ b/src/Commands/music/play.js @@ -1,4 +1,5 @@ const { Message} = require('discord.js') +const { joinVoiceChannel } = require('@discordjs/voice'); const { errorEmbed, musicEmbed} = require("../../util/Embeds") const { musicButtonRow } = require("../../util/buttonLayout") module.exports = { From f5b36c896f055afb94b180415baf6ef00189de91 Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 15:07:21 +0100 Subject: [PATCH 4/9] /nowPlaying reworked --- src/Commands/music/nowplaying.js | 36 +++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Commands/music/nowplaying.js b/src/Commands/music/nowplaying.js index a3303c1..56ee19d 100644 --- a/src/Commands/music/nowplaying.js +++ b/src/Commands/music/nowplaying.js @@ -1,6 +1,33 @@ const { errorEmbed, musicEmbed} = require("../../util/Embeds") const { musicButtonRow } = require("../../util/buttonLayout") + + +function generateProgressBar(currentTime, duration) { + + //make a ASCII progress bar |------🔴--------| + let progressBar = "|" + let progressBarLength = 25 + let progressBarMax = duration + let progressBarCurrent = currentTime + let progressBarPercent = (progressBarCurrent / progressBarMax) * 100 + let progressBarPercentRounded = Math.round(progressBarPercent/(100/progressBarLength)) + for (let i = 0; i < progressBarLength; i++) { + if (i < progressBarPercentRounded) { + progressBar = progressBar.concat("─") + } else if (i == progressBarPercentRounded) { + progressBar = progressBar.concat("🔹") + } else { + progressBar = progressBar.concat("─") + } + } + progressBar = progressBar.concat("|") + return progressBar + +} + + + module.exports = { name: "nowplaying", @@ -19,12 +46,15 @@ module.exports = { try { let playingSong = queue.songs[0] - console.log(playingSong.uploader.name); - message.reply({ embeds: [musicEmbed() + + + + + await message.reply({ embeds: [musicEmbed() .setTitle(`Playing ${playingSong.name}`) .setURL(`${playingSong.url}`) .setThumbnail(`${playingSong.thumbnail}`) - .setDescription(`${queue.formattedCurrentTime} **|-----------------------------|** ${playingSong.formattedDuration}`) + .setDescription(`${queue.formattedCurrentTime} **${generateProgressBar(queue.currentTime, playingSong.duration )}** ${playingSong.formattedDuration}`) .addField(`Requester`, `${playingSong.member}`, true) .addField(`Author`, `[${playingSong.uploader.name}](${playingSong.uploader.url})`, true) .addField(`Volume`, `${queue.volume}%`, true) From 8d9204a0dadaf30edbd0552289823d88992c1163 Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 15:09:40 +0100 Subject: [PATCH 5/9] random crash fix --- src/Events/guild/guildMemberAdd.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Events/guild/guildMemberAdd.js b/src/Events/guild/guildMemberAdd.js index 015cd94..bae3b3e 100644 --- a/src/Events/guild/guildMemberAdd.js +++ b/src/Events/guild/guildMemberAdd.js @@ -84,10 +84,12 @@ module.exports = { .setColor(0x00ff00) .setDescription(`Bonjour ${member} et bienvenue sur le serveur **${member.guild.name}**. Nous sommes maintenant **${member.guild.memberCount}** sur ce serveur.`) .setImage("attachment://welcome-image.png") - - member.guild.channels.cache.get(config.channel.bienvenueID).send({ embeds : [Addembed], files: [CanvasAttachment] }); - + try { + + member.guild.channels.cache.get(config.channel.bienvenueID).send({ embeds : [Addembed], files: [CanvasAttachment] }); + + var rol = member.guild.roles.cache.find(role => role.name === "Les Louveteaux"); member.roles.add(rol); From 886f20993adeabe96c527f40f820890955da1d22 Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 15:32:54 +0100 Subject: [PATCH 6/9] /roll added --- src/Commands/Fun/roll.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Commands/Fun/roll.js diff --git a/src/Commands/Fun/roll.js b/src/Commands/Fun/roll.js new file mode 100644 index 0000000..7abfd69 --- /dev/null +++ b/src/Commands/Fun/roll.js @@ -0,0 +1,35 @@ +const { joinVoiceChannel } = require('@discordjs/voice'); +const { MessageEmbed } = require('discord.js'); +module.exports = { + + name: "roll", + description: "roll a dice", + permission: "ADMINISTRATOR", + active : true, + + options: [ + { + name: "dice", + description: `Max number of you dice`, + type: "STRING", + required: false, + } + ], + async execute(message) { + + try{ + let dice = message.options.getString('dice') + if (dice==null) dice = "100"; + const roll = Math.floor(Math.random() * dice) + 1 + const embed = new MessageEmbed() + .setColor("#FF0000") + .setAuthor("Roll your dice", "https://upload.wikimedia.org/wikipedia/commons/5/53/Six_sided_dice.png") + .setTitle(`You rolled a ${roll} (0-${dice})`) + + message.reply({embeds: [embed]}) + } catch (error) { + console.log(error) + message.reply({ embeds: [errorEmbed().setDescription(`${error}`)], ephemeral: true }) + } + } +} From f4e5867b7ab9422f9cad8f8bc9da51c28e48e271 Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 15:38:51 +0100 Subject: [PATCH 7/9] /roll tweaks --- src/Commands/Fun/roll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/Fun/roll.js b/src/Commands/Fun/roll.js index 7abfd69..e272f54 100644 --- a/src/Commands/Fun/roll.js +++ b/src/Commands/Fun/roll.js @@ -24,7 +24,7 @@ module.exports = { const embed = new MessageEmbed() .setColor("#FF0000") .setAuthor("Roll your dice", "https://upload.wikimedia.org/wikipedia/commons/5/53/Six_sided_dice.png") - .setTitle(`You rolled a ${roll} (0-${dice})`) + .setDescription(`${message.user} rolled a ${roll} (0-${dice})`) message.reply({embeds: [embed]}) } catch (error) { From 94b3c114ba4d5882b28babd720f4327d7227f72c Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 15:59:28 +0100 Subject: [PATCH 8/9] /coinflip added --- src/Commands/Fun/pileouface.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Commands/Fun/pileouface.js diff --git a/src/Commands/Fun/pileouface.js b/src/Commands/Fun/pileouface.js new file mode 100644 index 0000000..5ae619e --- /dev/null +++ b/src/Commands/Fun/pileouface.js @@ -0,0 +1,28 @@ +const { joinVoiceChannel } = require('@discordjs/voice'); +const { MessageEmbed } = require('discord.js'); +module.exports = { + + name: "coinflip", + description: "Flip a coin", + permission: "ADMINISTRATOR", + active : true, + + async execute(message) { + + + try{ + let coin = Math.floor(Math.random() * 2) + + const coinEmbed = new MessageEmbed() + .setColor('#E1A741') + .setAuthor("Flip a coin", "https://www.pngall.com/wp-content/uploads/4/Dollar-Gold-Coin-PNG.png") + .setDescription(`${message.user} flipped a coin and got a ${coin === 0 ? "Pile" : "Face"}`) + .setTimestamp() + + message.reply({embeds: [coinEmbed]}) + } catch (error) { + console.log(error) + message.reply({ embeds: [errorEmbed().setDescription(`${error}`)], ephemeral: true }) + } + } +} From 903bb12af2a41d12c51ca85720b35d6b5cdff8eb Mon Sep 17 00:00:00 2001 From: MightyPotatoast Date: Fri, 5 Nov 2021 15:59:56 +0100 Subject: [PATCH 9/9] added timestamp on error msg and music --- src/util/Embeds.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/Embeds.js b/src/util/Embeds.js index 06c1e67..ce79608 100644 --- a/src/util/Embeds.js +++ b/src/util/Embeds.js @@ -8,6 +8,7 @@ module.exports = { return new MessageEmbed() .setColor("#FF0000") .setTitle("⛔ **Error**: ⛔") + .setTimestamp() }, @@ -16,7 +17,7 @@ module.exports = { return new MessageEmbed() .setColor("#7F00FF") .setAuthor("Spotifion", "https://www.iconsdb.com/icons/preview/violet/spotify-xxl.png") - + .setTimestamp() }, //!---------------------- POKEMON ------------------------------- pokemonEmbed: () => {