From 9049a5e6b830d75051b8c38287cb126cab0f1a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 9 Feb 2024 11:53:30 +0200 Subject: [PATCH] Fix code to work on this decade 1/x --- Struct/Client.js => Client.js | 32 +- Dockerfile | 3 + Struct/funcs/exe.js | 16 - Struct/funcs/ffmpeg.js | 7 - Struct/funcs/play.js | 40 - commands/bug.js | 14 - commands/cmduses.js | 12 +- commands/eval.js | 26 - commands/forcestop.js | 11 - commands/help.js | 43 +- commands/invite.js | 13 +- commands/loop.js | 35 +- commands/nowplaying.js | 12 +- commands/pause.js | 19 +- commands/play.js | 23 +- commands/playlist.js | 44 +- commands/playlist/add.js | 20 +- commands/playlist/delete.js | 4 +- commands/playlist/list.js | 10 +- commands/playlist/play.js | 30 +- commands/playlist/remove.js | 4 +- commands/playlist/save.js | 4 +- commands/queue.js | 15 +- commands/remove.js | 21 +- commands/resume.js | 21 +- commands/seek.js | 22 +- commands/settings.js | 44 +- commands/settings/announcesongs.js | 4 +- commands/settings/permissions.js | 4 +- commands/settings/prefix.js | 4 +- commands/settings/reset.js | 4 +- commands/settings/setDj.js | 16 +- commands/settings/setpremium.js | 6 +- commands/settings/songSelection.js | 4 +- commands/settings/volume.js | 4 +- commands/shuffle.js | 5 +- commands/skip.js | 29 +- commands/status.js | 24 +- commands/stop.js | 21 +- commands/volume.js | 19 +- config.js | 10 + config/config.js | 9 - events/guildcreate.js | 38 +- events/message.js | 7 +- events/ready.js | 80 +- {Struct/funcs => funcs}/dbget.js | 0 funcs/exe.js | 13 + {Struct/funcs => funcs}/handleVideo.js | 20 +- {Struct/funcs => funcs}/msToTime.js | 0 funcs/play.js | 48 + index.js | 18 +- package-lock.json | 3205 +++++++++++++++--------- package.json | 22 +- 53 files changed, 2455 insertions(+), 1704 deletions(-) rename Struct/Client.js => Client.js (54%) delete mode 100644 Struct/funcs/exe.js delete mode 100644 Struct/funcs/ffmpeg.js delete mode 100644 Struct/funcs/play.js delete mode 100644 commands/bug.js delete mode 100644 commands/eval.js delete mode 100644 commands/forcestop.js create mode 100644 config.js delete mode 100644 config/config.js rename {Struct/funcs => funcs}/dbget.js (100%) create mode 100644 funcs/exe.js rename {Struct/funcs => funcs}/handleVideo.js (69%) rename {Struct/funcs => funcs}/msToTime.js (100%) create mode 100644 funcs/play.js diff --git a/Struct/Client.js b/Client.js similarity index 54% rename from Struct/Client.js rename to Client.js index ec1f2633..b9abab4e 100644 --- a/Struct/Client.js +++ b/Client.js @@ -1,12 +1,18 @@ const { Client, Collection } = require('discord.js'); const admin = require('firebase-admin'); -const serviceAccount = require('./serviceAccount.json'); +require('dotenv/config'); module.exports = class extends Client { constructor() { super({ - disableEveryone: true, - disabledEvents: ['TYPING_START'] + intents: [ + "Guilds", + "GuildMessages", + "GuildVoiceStates", + "MessageContent" + ], + disableMentions: "everyone", + disabledEvents: ["TYPING_START"] }); this.commands = new Collection(); @@ -26,15 +32,9 @@ module.exports = class extends Client { this.funcs.handleVideo = require('./funcs/handleVideo.js'); this.funcs.play = require('./funcs/play.js'); this.funcs.msToTime = require('./funcs/msToTime.js'); - this.funcs.dbget = require('./funcs/dbget.js'); this.funcs.exe = require('./funcs/exe.js'); - this.funcs.ffmpeg = require('./funcs/ffmpeg.js'); - admin.initializeApp({ - credential: admin.credential.cert(serviceAccount), - }); - - this.db = admin.firestore(); + this.config = require('./config.js'); this.global = { db: { @@ -43,6 +43,16 @@ module.exports = class extends Client { }, }; - this.db.FieldValue = require('firebase-admin').firestore.FieldValue; + if(this.config.firebase.serviceAccount){ + this.funcs.dbget = require('./funcs/dbget.js'); + + admin.initializeApp({ + credential: admin.credential.cert(this.config.firebase.serviceAccount), + }); + + this.db = admin.firestore(); + + this.db.FieldValue = require('firebase-admin').firestore.FieldValue; + } } }; diff --git a/Dockerfile b/Dockerfile index e13e32b9..2eee3a1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,9 @@ FROM docker.io/node:20-alpine #Dependencies RUN apk add --virtual .build-deps python3 make g++ gcc git +#Code Dependencies +RUN apk add --virtual .code-deps ffmpeg + WORKDIR /usr/src/app COPY / /usr/src/app/ diff --git a/Struct/funcs/exe.js b/Struct/funcs/exe.js deleted file mode 100644 index b8849e60..00000000 --- a/Struct/funcs/exe.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = function (message, args, client, Discord, prefix, command) { - const permissions = message.channel.permissionsFor(message.client.user); - if (!permissions.has('EMBED_LINKS')) return message.channel.send(':x: I cannot send embeds (Embed links), make sure I have the proper permissions!'); - try { - command.uses++; - command.execute(message, args, client, Discord, prefix); - } catch (error) { - message.reply(`:x: there was an error trying to execute that command! Please contact support with \`${prefix}bug\`!`); - const embed = new Discord.RichEmbed() - .setTitle(`Musix ${error.toString()}`) - .setDescription(error.stack.replace(/at /g, '**at **')) - .setColor('#b50002'); - client.fetchUser(client.config.devId).then(user => user.send(embed)).catch(console.error); - client.channels.get(client.config.debug_channel).send(embed); - } -}; diff --git a/Struct/funcs/ffmpeg.js b/Struct/funcs/ffmpeg.js deleted file mode 100644 index d1a01e25..00000000 --- a/Struct/funcs/ffmpeg.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async function (client) { - try { - await client.channels.get('570531724002328577').join() - } catch (error) { - client.channels.get(client.config.debug_channel).send("Error detected: " + error); - } -}; \ No newline at end of file diff --git a/Struct/funcs/play.js b/Struct/funcs/play.js deleted file mode 100644 index b41ddc41..00000000 --- a/Struct/funcs/play.js +++ /dev/null @@ -1,40 +0,0 @@ -module.exports = async function (guild, song, client, message, seek, play) { - const Discord = require('discord.js'); - const ytdl = require('ytdl-core'); - const serverQueue = client.queue.get(guild.id); - if (!song) { - console.log('No song') - serverQueue.voiceChannel.leave(); - client.queue.delete(guild.id); - return; - } - const dispatcher = serverQueue.connection - .playStream(ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25 }), { seek: seek, bitrate: 1024, passes: 10, volume: 1 }) - .on("end", reason => { - if (reason === "Stream is not generating quickly enough.") { - console.log("Song ended"); - } else if (reason === "seek") { - return; - } else { - console.log(reason); - } - serverQueue.playing = false; - if (serverQueue.looping) { - serverQueue.songs.push(serverQueue.songs[0]); - } - serverQueue.songs.shift(); - client.funcs.play(guild, serverQueue.songs[0], client, message); - }); - dispatcher.setVolume(serverQueue.volume / 10); - dispatcher.on("error", error => console.error(error)); - if (client.global.db.guilds[guild.id].startPlaying || play) { - let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); - let songtime = (data.length_seconds * 1000).toFixed(0); - const embed = new Discord.RichEmbed() - .setTitle(`:musical_note: Start playing: **${song.title}**`) - .setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``) - .setColor("#b50002") - serverQueue.textChannel.send(embed); - } - serverQueue.playing = true; -} diff --git a/commands/bug.js b/commands/bug.js deleted file mode 100644 index f998f668..00000000 --- a/commands/bug.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - name: 'bug', - description: 'Report a bug', - alias: 'bug', - cooldown: 5, - onlyDev: false, - async execute(message, args, client, Discord, prefix) { - const embed = new Discord.RichEmbed() - .setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`) - .setDescription(`Matte#0002\nOr join the support server: https://discord.gg/rvHuJtB`) - .setColor(client.config.embedColor); - message.channel.send(embed); - }, -}; \ No newline at end of file diff --git a/commands/cmduses.js b/commands/cmduses.js index 0c10ab63..bd97a0c2 100644 --- a/commands/cmduses.js +++ b/commands/cmduses.js @@ -1,9 +1,11 @@ +const { EmbedBuilder } = require("discord.js"); + module.exports = { name: 'cmduses', usage: '', description: 'Command usage statistics', uses: 0, - async execute(msg, args, client, Discord) { + async execute(msg, args, client) { const cmduses = []; client.commands.forEach((value, key) => { cmduses.push([key, value.uses]); @@ -17,12 +19,12 @@ module.exports = { cmduses.forEach(x => { if (x[1] > 0) markdownrows.push(x[0] + '.'.repeat(cmdnamelength - x[0].length) + ' '.repeat(numberlength - x[1].toString().length) + x[1].toString()); }); - const embed = new Discord.RichEmbed(); + const embed = new EmbedBuilder(); embed .setTitle('Musix Command Usage During Current Uptime') .setDescription('```ml\n' + markdownrows.join('\n') + '\n```') - .setFooter('These statistics are from the current uptime.') + .setFooter({ text: 'These statistics are from the current uptime.' }) .setColor(client.config.embedColor); - msg.channel.send(embed); + msg.channel.send({ embeds: [embed] }); }, -}; \ No newline at end of file +}; diff --git a/commands/eval.js b/commands/eval.js deleted file mode 100644 index 4e4bfd02..00000000 --- a/commands/eval.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = { - name: 'eval', - description: 'Evaluation command', - alias: 'eval', - cooldown: 5, - onlyDev: true, - async execute(message, args, client, Discord, prefix) { - const ytdl = require('ytdl-core'); - const serverQueue = client.queue.get(message.guild.id); - if (serverQueue) { - let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); - } - const input = message.content.slice(prefix.length + 4); - let output; - try { - output = await eval(input); - } catch (error) { - output = error.toString(); - } - const embed = new Discord.RichEmbed() - .setTitle('Evaluation Command') - .setColor(client.config.embedColor) - .setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``); - return message.channel.send(embed); - }, -}; diff --git a/commands/forcestop.js b/commands/forcestop.js deleted file mode 100644 index 8004686a..00000000 --- a/commands/forcestop.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - name: 'forcestop', - description: 'force stop command.', - alias: 'fs', - cooldown: 5, - onlyDev: true, - execute(message, args, client, Discord, prefix) { - client.queue.delete(message.guild.id); - message.channel.send('queue deleted') - } -}; diff --git a/commands/help.js b/commands/help.js index 0b3a38bf..dfc6c55f 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,29 +1,32 @@ +const { EmbedBuilder } = require("discord.js"); + module.exports = { name: 'help', description: 'Help command.', alias: 'help', cooldown: 5, - onlyDev: false, - execute(message, args, client, Discord, prefix) { - const embed = new Discord.RichEmbed() + execute(message, args, client, prefix) { + const embed = new EmbedBuilder() .setTitle(`Commands for ${client.user.username}!`) - .addField(`${prefix}play | ${prefix}p`, 'Play a song.', true) - .addField(`${prefix}skip | ${prefix}s`, 'Skip a song.', true) - .addField(`${prefix}queue | ${prefix}q`, 'Display the queue.', true) - .addField(`${prefix}nowplaying | ${prefix}np`, 'Display what\'s currently playing.', true) - .addField(`${prefix}remove | ${prefix}rm`, 'Remove songs from the queue.', true) - .addField(`${prefix}volume`, 'Change or check the volume.', true) - .addField(`${prefix}pause`, 'Pause the music.', true) - .addField(`${prefix}resume`, 'Resume the music.', true) - .addField(`${prefix}loop`, 'Loop the queue.', true) - .addField(`${prefix}stop`, 'Stop the music, Clear the queue and leave the current voice channel.', true) - .addField(`${prefix}invite`, 'Invite Musix.', true) - .addField(`${prefix}status`, 'See different information for Musix.', true) - .addField(`${prefix}bug`, 'Report a bug.', true) - .addField(`${prefix}settings`, 'Change the guild specific settings.', true) - .addField(`${prefix}help`, 'Display the help.', true) - .setAuthor(message.member.username, message.member.displayAvatarURL) + .addFields( + { name: `${prefix}play | ${prefix}p`, value: 'Play a song.', inline: true }, + { name: `${prefix}skip | ${prefix}s`, value: 'Skip a song.', inline: true }, + { name: `${prefix}queue | ${prefix}q`, value: 'Display the queue.', inline: true }, + { name: `${prefix}nowplaying | ${prefix}np`, value: 'Display what\'s currently playing.', inline: true }, + { name: `${prefix}remove | ${prefix}rm`, value: 'Remove songs from the queue.', inline: true }, + { name: `${prefix}volume`, value: 'Change or check the volume.', inline: true }, + { name: `${prefix}pause`, value: 'Pause the music.', inline: true }, + { name: `${prefix}resume`, value: 'Resume the music.', inline: true }, + { name: `${prefix}loop`, value: 'Loop the queue.', inline: true }, + { name: `${prefix}seek`, value: 'Seek music.', inline: true }, + { name: `${prefix}stop`, value: 'Stop the music, Clear the queue and leave the current voice channel.', inline: true }, + { name: `${prefix}invite`, value: 'Invite Musix.', inline: true }, + { name: `${prefix}status`, value: 'See different information for Musix.', inline: true }, + { name: `${prefix}settings`, value: 'Change the guild specific settings.', inline: true }, + { name: `${prefix}help`, value: 'Display the help.', inline: true } + ) + .setAuthor({ name: client.user.username, iconURL: client.user.avatarURL()}) .setColor(client.config.embedColor) - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/invite.js b/commands/invite.js index f33e3d24..e643205b 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -1,14 +1,15 @@ +const { EmbedBuilder } = require("discord.js"); + module.exports = { name: 'invite', description: 'Invite command.', alias: 'invite', cooldown: 5, - onlyDev: false, - execute(message, args, client, Discord, prefix) { - const embed = new Discord.RichEmbed() + execute(message, args, client, prefix) { + const embed = new EmbedBuilder() .setTitle(`Invite ${client.user.username} to your Discord server!`) - .setURL(client.config.invite) + .setURL(`https://discord.com/oauth2/authorize?client_id=${client.user.id}&permissions=2184465408&scope=applications.commands+bot`) .setColor(client.config.embedColor) - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); } -}; \ No newline at end of file +}; diff --git a/commands/loop.js b/commands/loop.js index 59337ae8..8ac49fd8 100644 --- a/commands/loop.js +++ b/commands/loop.js @@ -1,28 +1,27 @@ +const { PermissionFlagsBits } = require('discord.js'); + module.exports = { name: 'loop', description: 'loop command.', alias: 'loop', cooldown: 10, - onlyDev: false, - async execute(message, args, client, Discord, prefix) { + async execute(message, args, client, prefix) { const serverQueue = client.queue.get(message.guild.id); const permissions = message.channel.permissionsFor(message.author); - const { voiceChannel } = message.member; + const voiceChannel = message.member.voice.channel; if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); - if (message.author.id !== client.config.devId) { - if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!'); - if (client.global.db.guilds[message.guild.id].permissions === true) { - if (client.global.db.guilds[message.guild.id].dj) { - if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to loop the queue!'); - } else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to loop the queue!'); - } - } - if (!serverQueue.looping) { - serverQueue.looping = true; - message.channel.send(':repeat: Looping the queue now!'); - } else { - serverQueue.looping = false; - message.channel.send(':repeat: No longer looping the queue!'); - } + if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!'); + if (client.global.db.guilds[message.guild.id].permissions === true) { + if (client.global.db.guilds[message.guild.id].dj) { + if (!message.member.roles.cache.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to loop the queue!'); + } else if (!permissions.has(PermissionFlagsBits.ManageChannels)) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to loop the queue!'); + } + if (!serverQueue.looping) { + serverQueue.looping = true; + message.channel.send(':repeat: Looping the queue now!'); + } else { + serverQueue.looping = false; + message.channel.send(':repeat: No longer looping the queue!'); + } } }; diff --git a/commands/nowplaying.js b/commands/nowplaying.js index b4bd1671..3d031d8d 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -1,10 +1,11 @@ +const { EmbedBuilder } = require('discord.js'); + module.exports = { name: 'nowplaying', description: 'Now playing command.', alias: 'np', cooldown: 5, - onlyDev: false, - async execute(message, args, client, Discord, prefix) { + async execute(message, args, client, prefix) { const ytdl = require('ytdl-core'); const serverQueue = client.queue.get(message.guild.id); if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); @@ -15,13 +16,12 @@ module.exports = { let barlength = 30; let completedpercent = ((completed / songtime) * barlength).toFixed(0); let array = []; for (let i = 0; i < completedpercent - 1; i++) { array.push('⎯'); } array.push('⭗'); for (let i = 0; i < barlength - completedpercent - 1; i++) { array.push('⎯'); } - const embed = new Discord.RichEmbed() + const embed = new EmbedBuilder() .setTitle("__Now playing__") .setDescription(`🎶**Now playing:** ${serverQueue.songs[0].title}\n${array.join('')} | \`${client.funcs.msToTime(completed)} / ${client.funcs.msToTime(songtime)}\``) - .setFooter(`Queued by ${serverQueue.songs[0].author.tag}`) + .setFooter({ text: `Queued by ${serverQueue.songs[0].author.tag}` }) .setURL(serverQueue.songs[0].url) .setColor(client.config.embedColor) - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); } }; - diff --git a/commands/pause.js b/commands/pause.js index c8f37a9f..d77b9c9c 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -1,25 +1,24 @@ +const { PermissionFlagsBits } = require('discord.js'); + module.exports = { name: 'pause', description: 'Pause command.', alias: 'pause', cooldown: 5, - onlyDev: false, - execute(message, args, client, Discord, prefix) { + execute(message, args, client, prefix) { const serverQueue = client.queue.get(message.guild.id); const permissions = message.channel.permissionsFor(message.author); - const { voiceChannel } = message.member; + const voiceChannel = message.member.voice.channel; if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); if (serverQueue.playing && !serverQueue.paused) { if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to pause the music!'); - if (message.author.id !== client.config.devId) { - if (client.global.db.guilds[message.guild.id].permissions === true) { - if (client.global.db.guilds[message.guild.id].dj) { - if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to pause the music!'); - } else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to pause the music!'); - } + if (client.global.db.guilds[message.guild.id].permissions === true) { + if (client.global.db.guilds[message.guild.id].dj) { + if (!message.member.roles.cache.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to pause the music!'); + } else if (!permissions.has(PermissionFlagsBits.ManageMessages)) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to pause the music!'); } serverQueue.paused = true; - serverQueue.connection.dispatcher.pause(); + serverQueue.audioPlayer.pause(); return message.channel.send('⏸ Paused the music!'); } else return message.channel.send(':x: There is nothing playing.'); } diff --git a/commands/play.js b/commands/play.js index 244a9994..a87d00ae 100644 --- a/commands/play.js +++ b/commands/play.js @@ -1,5 +1,6 @@ const YouTube = require("simple-youtube-api"); const he = require('he'); +const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = { name: 'play', @@ -8,13 +9,12 @@ module.exports = { alias: 'p', args: true, cooldown: 3, - onlyDev: false, - async execute(message, args, client, Discord, prefix) { - const youtube = new YouTube(client.config.api_key); + async execute(message, args, client, prefix) { + const youtube = new YouTube(client.config.youtube_api_key); const searchString = args.slice(1).join(" "); const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : ""; const serverQueue = client.queue.get(message.guild.id); - const voiceChannel = message.member.voiceChannel; + const voiceChannel = message.member.voice.channel; if (!serverQueue) { if (!voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in a voice channel to play music!'); } else { @@ -22,10 +22,10 @@ module.exports = { } if (!args[1]) return message.channel.send(':x: You need to use a link or search for a song!'); const permissions = voiceChannel.permissionsFor(message.client.user); - if (!permissions.has('CONNECT')) { + if (!permissions.has(PermissionFlagsBits.Connect)) { return message.channel.send(':x: I cannot connect to your voice channel, make sure I have the proper permissions!'); } - if (!permissions.has('SPEAK')) { + if (!permissions.has(PermissionFlagsBits.Speak)) { return message.channel.send(':x: I cannot speak in your voice channel, make sure I have the proper permissions!'); } if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { @@ -43,15 +43,16 @@ module.exports = { try { var videos = await youtube.searchVideos(searchString, 10); let index = 0; - const embed = new Discord.RichEmbed() + const embed = new EmbedBuilder() .setTitle("__Song Selection__") .setDescription(`${videos.map(video2 => `**${++index}** ${he.decode(video2.title)} `).join('\n')}`) - .setFooter("Please provide a number ranging from 1-10 to select one of the search results.") + .setFooter({ text: "Please provide a number ranging from 1-10 to select one of the search results." }) .setColor(client.config.embedColor) - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); try { - var response = await message.channel.awaitMessages(message2 => message2.content > 0 && message2.content < 11 && message2.author === message.author, { - maxMatches: 1, + var response = await message.channel.awaitMessages({ + filter: message2 => message2.content > 0 && message2.content < 11 && message2.author === message.author, + max: 1, time: 10000, errors: ['time'] }); diff --git a/commands/playlist.js b/commands/playlist.js index e549ccf1..bd3fdff3 100644 --- a/commands/playlist.js +++ b/commands/playlist.js @@ -1,5 +1,6 @@ const YouTube = require("simple-youtube-api"); const he = require('he'); +const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = { name: 'playlist', @@ -7,43 +8,36 @@ module.exports = { description: 'Save and load queues', alias: 'pl', cooldown: 10, - onlyDev: false, - async execute(message, args, client, Discord, prefix) { - const embed = new Discord.RichEmbed() + async execute(message, args, client, prefix) { + const embed = new EmbedBuilder() .setTitle('Options for playlist!') - .addField('play', 'Play the guild specific queue.', true) - .addField('save', 'Save the currently playing queue. Note that this will overwrite the currently saved queue!', true) - .addField('add', 'Add songs to the playlist. Like song selection', true) - .addField('remove', 'Remove songs from the playlist.', true) - .addField('list', 'Display the playlist.', true) - .setFooter(`how to use: ${prefix}playlist