From a64f9d2325c5c1f6a7b14353a9065a14173ef840 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Thu, 12 Mar 2020 13:56:31 +0200 Subject: [PATCH] Update 3.0.3 All messages reworked. --- commands/bass.js | 11 ++-- commands/bug.js | 2 +- commands/end.js | 2 +- commands/join.js | 6 +- commands/loop.js | 4 +- commands/loopsong.js | 5 +- commands/nowplaying.js | 5 +- commands/pause.js | 4 +- commands/play.js | 23 ++++---- commands/queue.js | 4 +- commands/reload.js | 2 +- commands/remove.js | 12 ++-- commands/restart.js | 2 +- commands/resume.js | 4 +- commands/search.js | 23 ++++---- commands/seek.js | 9 +-- commands/settings.js | 4 +- commands/settings/announcesongs.js | 4 +- commands/settings/bass.js | 8 +-- commands/settings/permissions.js | 12 ++-- commands/settings/prefix.js | 2 +- commands/settings/reset.js | 2 +- commands/settings/setDj.js | 8 +-- commands/settings/volume.js | 8 +-- commands/shuffle.js | 2 +- commands/skip.js | 20 +++---- commands/skipto.js | 8 +-- commands/status.js | 2 +- commands/stop.js | 2 +- commands/volume.js | 10 ++-- events/msg.js | 6 +- package-lock.json | 57 +++++++++--------- package.json | 8 +-- struct/client.js | 1 + struct/config/messages.js | 92 ++++++++++++++++++++++++++++++ struct/funcs/check.js | 9 +-- struct/funcs/exe.js | 6 +- struct/funcs/handleVideo.js | 7 ++- struct/funcs/play.js | 4 +- struct/funcs/urlMatch.js | 6 +- 40 files changed, 249 insertions(+), 157 deletions(-) create mode 100644 struct/config/messages.js diff --git a/commands/bass.js b/commands/bass.js index b0061eb3..d8a82fb2 100644 --- a/commands/bass.js +++ b/commands/bass.js @@ -9,14 +9,15 @@ module.exports = { category: 'music', execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); - if (!args[1] && serverQueue) return msg.channel.send(`:loud_sound: The current bass is: **${serverQueue.bass}**`); + if (!args[1] && serverQueue) return msg.channel.send(`${client.messages.currentBass}**${serverQueue.bass}**`); const bass = parseFloat(args[1]); if (client.funcs.check(client, msg, command)) { - if (isNaN(bass)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.'); - if (bass > 100) return msg.channel.send('<:redx:674263474704220182> The max bass is `100`!'); - if (bass < 0) return msg.channel.send('<:redx:674263474704220182> The volume needs to be a positive number!'); + if (isNaN(bass)) return msg.channel.send(client.messages.validNumber); + if (bass > 100) return msg.channel.send(client.messages.maxBass); + if (bass < 0) return msg.channel.send(client.messages.positiveBass); serverQueue.bass = bass; - return msg.channel.send(`<:volumehigh:674685637626167307> The bass level **${bass}** will be applied when the next song starts playing!`); + client.messages.bassApplied = client.messages.bassApplied.replace("%BASS%", bass); + return msg.channel.send(client.messages.bassApplied); } } }; diff --git a/commands/bug.js b/commands/bug.js index 16397f9c..5266f3f9 100644 --- a/commands/bug.js +++ b/commands/bug.js @@ -9,7 +9,7 @@ module.exports = { async execute(msg, args, client, Discord, prefix) { const embed = new Discord.MessageEmbed() .setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`) - .setDescription(`Matte#0002\nOr join the support server: https://discord.gg/rvHuJtB`) + .setDescription(client.messages.bug) .setColor(client.config.embedColor); msg.channel.send(embed); }, diff --git a/commands/end.js b/commands/end.js index 93622d17..6b63eb6a 100644 --- a/commands/end.js +++ b/commands/end.js @@ -8,6 +8,6 @@ module.exports = { category: 'util', async execute(msg, args, client, Discord, prefix, command) { client.queue.delete(msg.guild.id); - msg.channel.send('Queue deleted!'); + msg.channel.send(client.messages.queueDeleted); } }; diff --git a/commands/join.js b/commands/join.js index 690d624e..e332cf99 100644 --- a/commands/join.js +++ b/commands/join.js @@ -14,11 +14,11 @@ module.exports = { if (serverQueue) { serverQueue.connection = connection; } - msg.channel.send(`<:green_check_mark:674265384777416705> Joined ${voiceChannel.name}!`); + msg.channel.send(`${client.messages.joined} ${voiceChannel.name}!`); } catch (error) { client.queue.delete(msg.guild.id); - client.channels.get(client.config.debug_channel).send("Error with connecting to voice channel: " + error); - return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`); + client.channels.get(client.config.debug_channel).send(client.messages.errorConnecting + error); + return msg.channel.send(client.messages.error); } } }; \ No newline at end of file diff --git a/commands/loop.js b/commands/loop.js index 8d2b550f..bda01b48 100644 --- a/commands/loop.js +++ b/commands/loop.js @@ -11,10 +11,10 @@ module.exports = { if (client.funcs.check(client, msg, command)) { if (!serverQueue.looping) { serverQueue.looping = true; - msg.channel.send('<:repeat1:674685561377914892> Looping the queue now!'); + msg.channel.send(client.messages.looping); } else { serverQueue.looping = false; - msg.channel.send('<:repeat1:674685561377914892> No longer looping the queue!'); + msg.channel.send(client.messages.noLooping); } } } diff --git a/commands/loopsong.js b/commands/loopsong.js index d44f0edf..94dfb522 100644 --- a/commands/loopsong.js +++ b/commands/loopsong.js @@ -11,10 +11,11 @@ module.exports = { if (client.funcs.check(client, msg, command)) { if (!serverQueue.songLooping) { serverQueue.songLooping = true; - msg.channel.send(`<:repeatsong:674685573419761716> Looping **${serverQueue.songs[0].title}** now!`); + client.messages.loopingSong = client.messages.loopingSong.replace("%TITLE%", serverQueue.songs[0].title); + msg.channel.send(client.messages.loopingSong); } else { serverQueue.songLooping = false; - msg.channel.send('<:repeatsong:674685573419761716> No longer looping the song!'); + msg.channel.send(client.messages.noLoopingSong); } } } diff --git a/commands/nowplaying.js b/commands/nowplaying.js index 3bdb6aa4..887b81c3 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -10,8 +10,7 @@ module.exports = { const getThumb = require('video-thumbnail-url'); const ytdl = require('ytdl-core'); const serverQueue = client.queue.get(msg.guild.id); - if (!serverQueue) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.'); - if (!serverQueue.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.'); + if (!serverQueue || !serverQueue.playing) return msg.channel.send(client.messages.noServerQueue); let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); let songtime = (data.length_seconds * 1000).toFixed(0); serverQueue.time = serverQueue.connection.dispatcher.streamTime; @@ -21,7 +20,7 @@ module.exports = { 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 thumbnail = getThumb(serverQueue.songs[0].url); const embed = new Discord.MessageEmbed() - .setTitle("__Now playing__") + .setTitle(client.messages.nowPlaying) .setDescription(`**Now playing:** ${serverQueue.songs[0].title}\n${array.join('')} | \`${client.funcs.msToTime(completed, "hh:mm:ss")} / ${client.funcs.msToTime(songtime, "hh:mm:ss")}\``) .setFooter(`Queued by ${serverQueue.songs[0].author.tag}`) .setURL(serverQueue.songs[0].url) diff --git a/commands/pause.js b/commands/pause.js index f499e87c..a5f88474 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -9,10 +9,10 @@ module.exports = { execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { - if (serverQueue.paused) return msg.channel.send('<:redx:674263474704220182> The music is already paused!'); + if (serverQueue.paused) return msg.channel.send(client.messages.alreadyPaused); serverQueue.paused = true; serverQueue.connection.dispatcher.pause(true); - return msg.channel.send('<:pause:674685548610322462> Paused the music!'); + return msg.channel.send(client.messages.paused); } } }; diff --git a/commands/play.js b/commands/play.js index 92984bc2..d34457a8 100644 --- a/commands/play.js +++ b/commands/play.js @@ -15,31 +15,28 @@ module.exports = { const serverQueue = client.queue.get(msg.guild.id); const voiceChannel = msg.member.voice.channel; if (!serverQueue) { - if (!msg.member.voice.channel) return msg.channel.send('<:redx:674263474704220182> I\'m sorry but you need to be in a voice channel to play music!'); + if (!msg.member.voice.channel) return msg.channel.send(client.messages.noVoiceChannel); } else { - if (voiceChannel !== serverQueue.voiceChannel) return msg.channel.send('<:redx:674263474704220182> I\'m sorry but you need to be in the same voice channel as Musix to play music!'); + if (voiceChannel !== serverQueue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel); } - if (!args[1]) return msg.channel.send('<:redx:674263474704220182> You need to use a link or search for a song!'); + if (!args[1]) return msg.channel.send(client.messages.noQuery); const permissions = voiceChannel.permissionsFor(msg.client.user); if (!permissions.has('CONNECT')) { - return msg.channel.send('<:redx:674263474704220182> I cannot connect to your voice channel, make sure I have the proper permissions!'); + return msg.channel.send(client.messages.noPermsConnect); } if (!permissions.has('SPEAK')) { - return msg.channel.send('<:redx:674263474704220182> I cannot speak in your voice channel, make sure I have the proper permissions!'); + return msg.channel.send(client.messages.noPermsSpeak); } if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { - const lmsg = await msg.channel.send(' Loading song(s)'); + const lmsg = await msg.channel.send(client.messages.loadingSongs); const playlist = await youtube.getPlaylist(url); const videos = await playlist.getVideos(); for (const video of Object.values(videos)) { - const video2 = await youtube.getVideoByID(video.id) - .catch(err => { - console.error(err); - return lmsg.edit(`<:redx:674263474704220182> Error loading songs!\nNot all songs we're loaded! This may have been caused by the playlist containing privated/deleted videos!`); - }); + const video2 = await youtube.getVideoByID(video.id); await client.funcs.handleVideo(video2, msg, voiceChannel, client, true); } - return lmsg.edit(`<:green_check_mark:674265384777416705> Playlist: **${playlist.title}** has been added to the queue!`); + client.messages.playlistAdded = client.messages.playlistAdded.replace("%TITLE%", playlist.title); + return lmsg.edit(client.messages.playlistAdded); } else { try { var video = await youtube.getVideo(url); @@ -49,7 +46,7 @@ module.exports = { var video = await youtube.getVideoByID(videos[0].id); } catch (err) { console.error(err); - return msg.channel.send('<:redx:674263474704220182> I could not obtain any search results!'); + return msg.channel.send(client.messages.noResults); } } return client.funcs.handleVideo(video, msg, voiceChannel, client, false); diff --git a/commands/queue.js b/commands/queue.js index 8ec51a30..05ed432b 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -8,9 +8,9 @@ module.exports = { category: 'music', async execute(msg, args, client, Discord, prefix) { const serverQueue = client.queue.get(msg.guild.id); - if (!serverQueue) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.'); + if (!serverQueue) return msg.channel.send(client.messages.noServerQueue); if (args[1]) { - if (isNaN(args[1])) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.'); + if (isNaN(args[1])) return msg.channel.send(client.messages.validNumber); } let page = parseInt(args[1]); if (!page) page = 1; diff --git a/commands/reload.js b/commands/reload.js index 59baca52..3c00d31f 100644 --- a/commands/reload.js +++ b/commands/reload.js @@ -25,6 +25,6 @@ module.exports = { /*fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { this.funcs[filename.slice(0, -3)] = require(`../struct/funcs/${filename}`); });*/ - msg.channel.send('All files reloaded!'); + msg.channel.send(client.messages.reloaded); } }; diff --git a/commands/remove.js b/commands/remove.js index 25cc14c8..6b923e3d 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -9,12 +9,14 @@ module.exports = { execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { - if (!args[1]) return msg.channel.send('<:redx:674263474704220182> Please provide a song position in queue for me to remove!'); + if (!args[1]) return msg.channel.send(client.messages.provideASong); const pos = parseInt(args[1]); - if (isNaN(pos)) return msg.channel.send('<:redx:674263474704220182> You need to enter a number!'); - if (pos < 1) return msg.channel.send('<:redx:674263474704220182> That songs does not exist!'); - if (pos > serverQueue.songs.length) return msg.channel.send(`<:redx:674263474704220182> There is only ${serverQueue.songs.length} amount of songs in the queue!`); - msg.channel.send(`🗑️ removed \`${serverQueue.songs[pos].title}\` from the queue!`); + if (isNaN(pos)) return msg.channel.send(client.messages.validNumber); + if (pos < 1) return msg.channel.send(client.messages.noSongs); + client.messages.queueLength = client.messages.queueLength.replace("%LENGTH%", serverQueue.songs.length); + if (pos > serverQueue.songs.length) return msg.channel.send(client.messages.queueLength); + client.messages.removed = client.messages.removed.replace("%SONG%", serverQueue.songs[pos].title); + msg.channel.send(client.messages.removed); return serverQueue.songs.splice(pos, 1); } } diff --git a/commands/restart.js b/commands/restart.js index 148b9cf4..abe84b6f 100644 --- a/commands/restart.js +++ b/commands/restart.js @@ -9,6 +9,6 @@ module.exports = { async execute(msg, args, client, Discord, prefix, command) { client.destroy(); require('../index.js'); - msg.channel.send('restarted!'); + msg.channel.send(client.messages.restart); } }; diff --git a/commands/resume.js b/commands/resume.js index 096cc370..06a4dc78 100644 --- a/commands/resume.js +++ b/commands/resume.js @@ -9,10 +9,10 @@ module.exports = { execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { - if (!serverQueue.paused) return msg.channel.send('<:redx:674263474704220182> The music in not paused!'); + if (!serverQueue.paused) return msg.channel.send(client.messages.notPaused); serverQueue.paused = false; serverQueue.connection.dispatcher.resume(true); - return msg.channel.send('<:resume:674685585478254603> Resumed the music!'); + return msg.channel.send(client.messages.resumed); } } }; diff --git a/commands/search.js b/commands/search.js index 41337437..736143c8 100644 --- a/commands/search.js +++ b/commands/search.js @@ -16,27 +16,28 @@ module.exports = { const serverQueue = client.queue.get(msg.guild.id); const voiceChannel = msg.member.voice.channel; if (!serverQueue) { - if (!msg.member.voice.channel) return msg.channel.send('<:redx:674263474704220182> I\'m sorry but you need to be in a voice channel to play music!'); + if (!msg.member.voice.channel) return msg.channel.send(client.messages.noVoiceChannel); } else { - if (voiceChannel !== serverQueue.voiceChannel) return msg.channel.send('<:redx:674263474704220182> I\'m sorry but you need to be in the same voice channel as Musix to play music!'); + if (voiceChannel !== serverQueue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel); } - if (!args[1]) return msg.channel.send('<:redx:674263474704220182> You need to use a link or search for a song!'); + if (!args[1]) return msg.channel.send(client.messages.noQuery); const permissions = voiceChannel.permissionsFor(msg.client.user); if (!permissions.has('CONNECT')) { - return msg.channel.send('<:redx:674263474704220182> I cannot connect to your voice channel, make sure I have the proper permissions!'); + return msg.channel.send(client.messages.noPermsConnect); } if (!permissions.has('SPEAK')) { - return msg.channel.send('<:redx:674263474704220182> I cannot speak in your voice channel, make sure I have the proper permissions!'); + return msg.channel.send(client.messages.noPermsSpeak); } if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { - const lmsg = await msg.channel.send(' Loading song(s)'); + const lmsg = await msg.channel.send(client.messages.loadingSongs); const playlist = await youtube.getPlaylist(url); const videos = await playlist.getVideos(); for (const video of Object.values(videos)) { const video2 = await youtube.getVideoByID(video.id); await client.funcs.handleVideo(video2, msg, voiceChannel, client, true); } - return lmsg.edit(`<:green_check_mark:674265384777416705> Playlist: **${playlist.title}** has been added to the queue!`); + client.messages.playlistAdded = client.messages.playlistAdded.replace("%TITLE%", playlist.title); + return lmsg.edit(client.messages.playlistAdded); } else { try { var video = await youtube.getVideo(url); @@ -45,9 +46,9 @@ module.exports = { var videos = await youtube.searchVideos(searchString, 10); let index = 0; const embed = new Discord.MessageEmbed() - .setTitle("__Song Selection__") + .setTitle(client.messages.songSelection) .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(client.messages.provideANumber) .setColor(client.config.embedColor) msg.channel.send(embed); try { @@ -58,13 +59,13 @@ module.exports = { }); } catch (err) { console.error(err); - return msg.channel.send('<:redx:674263474704220182> Cancelling video selection'); + return msg.channel.send(client.messages.cancellingVideoSelection); } const videoIndex = parseInt(response.first().content); var video = await youtube.getVideoByID(videos[videoIndex - 1].id); } catch (err) { console.error(err); - return msg.channel.send('<:redx:674263474704220182> I could not obtain any search results!'); + return msg.channel.send(client.messages.noResults); } } return client.funcs.handleVideo(video, msg, voiceChannel, client, false); diff --git a/commands/seek.js b/commands/seek.js index 3000b28c..24522802 100644 --- a/commands/seek.js +++ b/commands/seek.js @@ -1,7 +1,7 @@ module.exports = { name: 'seek', alias: 'none', - usage: '', + usage: '', description: 'Seek to a specific point in the currently playing song.', onlyDev: true, permission: 'MANAGE_MESSAGES', @@ -11,12 +11,13 @@ module.exports = { const serverQueue = client.queue.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); - if (!args[1]) return msg.channel.send(`<:redx:674263474704220182> Correct usage: \`${prefix}seek \``); + if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${prefix}seek ${command.usage}\``); let point = args[1]; const pos = parseInt(args[1]); if (isNaN(pos)) { - if (pos < 0) return msg.channel.send('<:redx:674263474704220182> The seeking point needs to be a positive number!'); - if (pos > data.length_seconds) return msg.channel.send(`<:redx:674263474704220182> The lenght of this song is ${data.length_seconds} seconds! You can't seek further than that!`); + if (pos < 0) return msg.channel.send(client.messages.seekingPointPositive); + client.messages.seekMax = client.messages.seekMax.replace("%LENGTH%", data.length_seconds); + if (pos > data.length_seconds) return msg.channel.send(client.messages.seekMax); point = pos; } serverQueue.connection.dispatcher.end(); diff --git a/commands/settings.js b/commands/settings.js index 5a1d0932..400cd7bd 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -20,7 +20,7 @@ module.exports = { .setColor(client.embedColor) const permissions = msg.channel.permissionsFor(msg.author); if (msg.author.id !== client.config.devId) { - if (!permissions.has(command.permission)) return msg.channel.send('<:redx:674263474704220182> You need the `MANAGE_SERVER` permission to change the settings!'); + if (!permissions.has(command.permission)) return msg.channel.send(client.messages.noPermsManageSettings); } if (args[1]) { const optionName = args[1].toLowerCase(); @@ -29,7 +29,7 @@ module.exports = { try { option.execute(msg, args, client, Discord, prefix); } catch (error) { - msg.reply(`<:redx:674263474704220182> there was an error trying to execute that option! Please contact support with \`${prefix}bug\`!`); + msg.reply(client.messages.errorExeOpt); const embed = new Discord.MessageEmbed() .setTitle(`Musix ${error.toString()}`) .setDescription(error.stack.replace(/at /g, '**at **')) diff --git a/commands/settings/announcesongs.js b/commands/settings/announcesongs.js index a48cedf4..c64bb35d 100644 --- a/commands/settings/announcesongs.js +++ b/commands/settings/announcesongs.js @@ -3,10 +3,10 @@ module.exports = { async execute(msg, args, client, Discord, prefix) { if (client.global.db.guilds[msg.guild.id].startPlaying) { client.global.db.guilds[msg.guild.id].startPlaying = false; - return msg.channel.send('<:green_check_mark:674265384777416705> announcesongs now set to `false`!'); + return msg.channel.send(client.messages.announceSongsFalse); } else { client.global.db.guilds[msg.guild.id].startPlaying = true; - return msg.channel.send('<:green_check_mark:674265384777416705> announcesongs now set to `true`!'); + return msg.channel.send(client.messages.announceSongsTrue); } } }; \ No newline at end of file diff --git a/commands/settings/bass.js b/commands/settings/bass.js index 374cca2c..ff4b5f1b 100644 --- a/commands/settings/bass.js +++ b/commands/settings/bass.js @@ -1,14 +1,14 @@ module.exports = { name: 'bass', async execute(msg, args, client, Discord, prefix) { - if (!args[2]) return msg.channel.send('Currect bass level: ' + client.global.db.guilds[msg.guild.id].bass); + if (!args[2]) return msg.channel.send(client.messages.currentDefaultBass + client.global.db.guilds[msg.guild.id].bass); if (args[2] === "false") { client.global.db.guilds[msg.guild.id].bass = false; - msg.channel.send(`Bass is now false!`); + msg.channel.send(client.messages.bassFalse); } const level = parseInt(args[2]); - if (isNaN(level)) return msg.channel.send('You need to provide a number?'); + if (isNaN(level)) return msg.channel.send(client.messages.validNumber); client.global.db.guilds[msg.guild.id].bass = level; - msg.channel.send(`Bass level is now ${level}!`); + msg.channel.send(`${client.messages.bassLevel} ${level}!`); } }; \ No newline at end of file diff --git a/commands/settings/permissions.js b/commands/settings/permissions.js index 9e84b508..a60d5b89 100644 --- a/commands/settings/permissions.js +++ b/commands/settings/permissions.js @@ -1,17 +1,17 @@ module.exports = { name: 'permissions', async execute(msg, args, client, Discord, prefix) { - if (!args[2]) return msg.channel.send(`🔒 Permission requirement: \`${client.global.db.guilds[msg.guild.id].permissions}\``); + if (!args[2]) return msg.channel.send(`${client.messages.permissions} \`${client.global.db.guilds[msg.guild.id].permissions}\``); if (args[2] === 'true') { if (!client.global.db.guilds[msg.guild.id].permissions) { client.global.db.guilds[msg.guild.id].permissions = true; - msg.channel.send(`<:green_check_mark:674265384777416705> Permissions requirement now set to: \`true\``); - } else return msg.channel.send('<:redx:674263474704220182> That value is already `true`!'); + msg.channel.send(client.messages.permissionsSetTrue); + } else return msg.channel.send(client.messages.permissionsTrue); } else if (args[2] === 'false') { if (client.global.db.guilds[msg.guild.id].permissions) { client.global.db.guilds[msg.guild.id].permissions = false; - msg.channel.send(`<:green_check_mark:674265384777416705> Permissions requirement now set to: \`false\``); - } else return msg.channel.send('<:redx:674263474704220182> That value is already `false`!'); - } else return msg.channel.send('<:redx:674263474704220182> Please define a boolean! (true/false)'); + msg.channel.send(client.messages.permissionsSetFalse); + } else return msg.channel.send(client.messages.permissionsFalse); + } else return msg.channel.send(client.messages.boolean); } }; \ No newline at end of file diff --git a/commands/settings/prefix.js b/commands/settings/prefix.js index b62b9a57..74c3c812 100644 --- a/commands/settings/prefix.js +++ b/commands/settings/prefix.js @@ -3,6 +3,6 @@ module.exports = { async execute(msg, args, client, Discord, prefix) { if (!args[2]) return msg.channel.send(`Current prefix: \`${client.global.db.guilds[msg.guild.id].prefix}\``); client.global.db.guilds[msg.guild.id].prefix = args[2]; - msg.channel.send(`<:green_check_mark:674265384777416705> New prefix set to: \`${args[2]}\``); + msg.channel.send(`${client.messages.prefixSet} \`${args[2]}\``); } }; \ No newline at end of file diff --git a/commands/settings/reset.js b/commands/settings/reset.js index d9ee2eee..6ef2acfe 100644 --- a/commands/settings/reset.js +++ b/commands/settings/reset.js @@ -9,6 +9,6 @@ module.exports = { dj: false, djrole: null }; - msg.channel.send('<:green_check_mark:674265384777416705> Reset __all__ guild settings!'); + msg.channel.send(client.messages.reset); } }; \ No newline at end of file diff --git a/commands/settings/setDj.js b/commands/settings/setDj.js index 2a1eb3eb..b2eaf4c6 100644 --- a/commands/settings/setDj.js +++ b/commands/settings/setDj.js @@ -7,22 +7,22 @@ module.exports = { } if (msg.guild.roles.cache.find(x => x.name === "DJ")) { client.global.db.guilds[msg.guild.id].djrole = msg.guild.roles.cache.find(x => x.name === "DJ").id; - msg.channel.send('<:green_check_mark:674265384777416705> I found a `DJ` role from this guild! This role is now the DJ role.'); + msg.channel.send(client.messages.djRoleFound); client.global.db.guilds[msg.guild.id].dj = true; } else { const permissions = msg.channel.permissionsFor(msg.client.user); - if (!permissions.has('MANAGE_ROLES')) return msg.channel.send('<:redx:674263474704220182> I cannot create roles (Manage roles), make sure I have the proper permissions! I will need this permission to create a `DJ` role since i did not find one!'); + if (!permissions.has('MANAGE_ROLES')) return msg.channel.send(client.messages.noPermsManageRoles); msg.guild.createRole({ name: 'DJ', }) .then(role => client.global.db.guilds[msg.guild.id].djrole = role.id) .catch(console.error) client.global.db.guilds[msg.guild.id].dj = true; - msg.channel.send('<:green_check_mark:674265384777416705> I did not find a role `DJ` so i have created one for you!'); + msg.channel.send(client.messages.djRoleCreated); } } else { client.global.db.guilds[msg.guild.id].dj = false; - msg.channel.send('<:green_check_mark:674265384777416705> `DJ` now set to `false`'); + msg.channel.send(client.messages.djFalse); } } }; \ No newline at end of file diff --git a/commands/settings/volume.js b/commands/settings/volume.js index f635a271..95105553 100644 --- a/commands/settings/volume.js +++ b/commands/settings/volume.js @@ -1,10 +1,10 @@ module.exports = { name: 'volume', async execute(msg, args, client, Discord, prefix) { - if (!args[2]) return msg.channel.send(`:speaker: Current default volume is: \`${client.global.db.guilds[msg.guild.id].defaultVolume}\``); - if (isNaN(args[2])) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But the default volume needs to be a valid __number__.'); - if (args[2].length > 2) return msg.channel.send('<:redx:674263474704220182> The default volume must be below `100` for quality and safety resons.'); + if (!args[2]) return msg.channel.send(`${client.messages.currentDefaultVolume} \`${client.global.db.guilds[msg.guild.id].defaultVolume}\``); + if (isNaN(args[2])) return msg.channel.send(client.messages.defaultVolumeNumber); + if (args[2].length > 2) return msg.channel.send(client.messages.defaultVolumeMax); client.global.db.guilds[msg.guild.id].defaultVolume = args[2]; - msg.channel.send(`<:green_check_mark:674265384777416705> Default volume set to: \`${args[2]}\``); + msg.channel.send(`${client.messages.defaultVolumeSet} \`${args[2]}\``); } }; \ No newline at end of file diff --git a/commands/shuffle.js b/commands/shuffle.js index 597cf9a7..42bea505 100644 --- a/commands/shuffle.js +++ b/commands/shuffle.js @@ -10,7 +10,7 @@ module.exports = { const serverQueue = client.queue.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { client.funcs.shuffle(serverQueue.songs); - msg.channel.send('<:shuffle:674685595980791871> Queue suffled!'); + msg.channel.send(client.messages.shuffled); } } }; \ No newline at end of file diff --git a/commands/skip.js b/commands/skip.js index ec2127b8..43c2a52e 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -9,33 +9,33 @@ module.exports = { execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); const permissions = msg.channel.permissionsFor(msg.author); - if (!serverQueue || !serverQueue.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing!'); + if (!serverQueue || !serverQueue.playing) return msg.channel.send(client.messages.noServerQueue); if (msg.author.id !== client.config.devId) { - if (msg.member.voice.channel !== serverQueue.voiceChannel) return msg.channel.send('<:redx:674263474704220182> I\'m sorry but you need to be in the same voice channel as Musix!'); + if (msg.member.voice.channel !== serverQueue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel); if (client.global.db.guilds[msg.guild.id].permissions) { if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole) || !permissions.has(command.permission)) { return vote(serverQueue, msg, client); } else { - return skipSong(serverQueue, msg); + return skipSong(serverQueue, msg, client); } } else { - return skipSong(serverQueue, msg); + return skipSong(serverQueue, msg, client); } } else { - return skipSong(serverQueue, msg); + return skipSong(serverQueue, msg, client); } } }; -function skipSong(serverQueue, msg) { - msg.channel.send('<:skip:674685614221688832> Skipped the song!'); +function skipSong(serverQueue, msg, client) { + msg.channel.send(client.messages.skipped); serverQueue.endReason = "skip"; serverQueue.connection.dispatcher.end(); }; -function vote(serverQueue, msg) { +function vote(serverQueue, msg, client) { serverQueue.votesNeeded = Math.floor(serverQueue.voiceChannel.members.size / 2); serverQueue.votesNeeded.toFixed(); if (serverQueue.voiceChannel.members.size > 2) { - if (serverQueue.voters.includes(msg.member.id)) return msg.channel.send('<:redx:674263474704220182> You have already voted to skip!'); + if (serverQueue.voters.includes(msg.member.id)) return msg.channel.send(client.messages.alreadyVoted); serverQueue.votes++; serverQueue.voters.push(msg.member.id); if (serverQueue.votes >= serverQueue.votesNeeded) { @@ -43,7 +43,7 @@ function vote(serverQueue, msg) { serverQueue.votes = 0; serverQueue.votesNeeded = null; return skipSong(serverQueue, msg); - } else return msg.channel.send(`<:redx:674263474704220182> Not enough votes! ${serverQueue.votes} / ${serverQueue.votesNeeded}!`); + } else return msg.channel.send(`${client.messages.notEnoughVotes} ${serverQueue.votes} / ${serverQueue.votesNeeded}!`); } else { return skipSong(serverQueue, msg); } diff --git a/commands/skipto.js b/commands/skipto.js index c7fdda04..4a416bb9 100644 --- a/commands/skipto.js +++ b/commands/skipto.js @@ -9,11 +9,11 @@ module.exports = { async execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { - if (!args[1]) return msg.channel.send(`<:redx:674263474704220182> correct usage: \`${command.usage}\``); + if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${command.usage}\``); const point = parseInt(args[1] - 1); - if (isNaN(point)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.'); - if (point > serverQueue.songs.size) return msg.channel.send('<:redx:674263474704220182> That song does not exist!'); - if (point < 1) return msg.channel.send('<:redx:674263474704220182> You can\'t skip to the song currently playing!'); + if (isNaN(point)) return msg.channel.send(client.messages.validNumber); + if (point > serverQueue.songs.size) return msg.channel.send(client.messages.noSongs); + if (point < 1) return msg.channel.send(client.messages.cantSkipToCurrent); let i = 0; while (i < point) { i++; diff --git a/commands/status.js b/commands/status.js index f22c0ed0..43284634 100644 --- a/commands/status.js +++ b/commands/status.js @@ -8,7 +8,7 @@ module.exports = { category: 'info', execute(msg, args, client, Discord, prefix) { const uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss"); - msg.channel.send(' Pinging...').then(m => { + msg.channel.send(client.messages.pinging).then(m => { const latency = m.createdTimestamp - msg.createdTimestamp; const embed = new Discord.MessageEmbed() diff --git a/commands/stop.js b/commands/stop.js index 11aed411..f2378915 100644 --- a/commands/stop.js +++ b/commands/stop.js @@ -13,7 +13,7 @@ module.exports = { serverQueue.looping = false; serverQueue.endReason = "stop"; serverQueue.connection.dispatcher.end(); - msg.channel.send('<:stop:674685626108477519> Stopped the music!') + msg.channel.send(client.messages.stop) } } }; diff --git a/commands/volume.js b/commands/volume.js index ac11f6e1..a53c487d 100644 --- a/commands/volume.js +++ b/commands/volume.js @@ -9,15 +9,15 @@ module.exports = { category: 'music', execute(msg, args, client, Discord, prefix, command) { const serverQueue = client.queue.get(msg.guild.id); - if (!args[1] && serverQueue) return msg.channel.send(`:loud_sound: The current volume is: **${serverQueue.volume}**`); + if (!args[1] && serverQueue) return msg.channel.send(`${client.messages.currentVolume}**${serverQueue.volume}**`); const volume = parseFloat(args[1]); if (client.funcs.check(client, msg, command)) { - if (isNaN(volume)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.'); - if (volume > 100) return msg.channel.send('<:redx:674263474704220182> The max volume is `100`!'); - if (volume < 0) return msg.channel.send('<:redx:674263474704220182> The volume needs to be a positive number!'); + if (isNaN(volume)) return msg.channel.send(client.messages.validNumber); + if (volume > 100) return msg.channel.send(client.messages.maxVolume); + if (volume < 0) return msg.channel.send(client.messages.positiveVolume); serverQueue.volume = volume; serverQueue.connection.dispatcher.setVolume(volume / 5); - return msg.channel.send(`<:volumehigh:674685637626167307> I set the volume to: **${volume}**`); + return msg.channel.send(`${client.messages.setVolume}**${volume}**`); } } }; diff --git a/events/msg.js b/events/msg.js index 61941894..77c53a8b 100644 --- a/events/msg.js +++ b/events/msg.js @@ -8,7 +8,7 @@ module.exports = { if (msg.mentions.users.first()) { if (msg.mentions.users.first().id === client.user.id) { if (!args[1]) return; - if (args[1] === 'prefix') return msg.channel.send(`My prefix here is: \`${prefix}\`.`); + if (args[1] === 'prefix') return msg.channel.send(`${client.messages.prefixHere}\`${prefix}\`.`); if (args[1] === 'help') { const command = client.commands.get("help"); return client.funcs.exe(msg, args, client, Discord, prefix, command); @@ -21,8 +21,8 @@ module.exports = { if (commandName === "none") return; const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName); if (!command && msg.content !== `${prefix}`) return; - if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send('<:redx:674263474704220182> You are not allowed to do that!'); - if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send('<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!'); + if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send(client.messages.notAllowed); + if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send(client.messages.devMode); client.funcs.exe(msg, args, client, Discord, prefix, command); } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7d8f3dac..5377c193 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "musix", - "version": "3.0.2", + "version": "3.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -19,9 +19,9 @@ } }, "@firebase/analytics": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.2.15.tgz", - "integrity": "sha512-pNRyLU6PndZa0iO+HN+GwY1HobsyU584a1KN5ZWBuwaqbUOB/99uChn2n6XaPrlD/G07uzv6dpw558IQXahhow==", + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.2.16.tgz", + "integrity": "sha512-t4lwd8SxigKULvt8a+VA1cVj7Aml/tUNECV9vzz3G9wusxDE76d7rTw+HexKTNPRbD2E9+JtRKUVPKlJpox9bw==", "requires": { "@firebase/analytics-types": "0.2.7", "@firebase/component": "0.1.6", @@ -152,12 +152,12 @@ } }, "@firebase/firestore": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.11.2.tgz", - "integrity": "sha512-WWTKQGUYvZ7BELzEeIhINVm+iKL2ki/f0y16Qc3kABCW4kdXtiUHak6uWMFQ3IXHtnpDGzcNTyDAKOWeZx+TzA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.12.0.tgz", + "integrity": "sha512-GWFU3pPs0xyp2ynFQIyvlmTtg4goGvOkT/lhVCu/Bq6/78xbl395nCPBMjF7IpUl+aVqQVUCwtF/cxrtNXgjMA==", "requires": { "@firebase/component": "0.1.6", - "@firebase/firestore-types": "1.9.2", + "@firebase/firestore-types": "1.10.0", "@firebase/logger": "0.1.36", "@firebase/util": "0.2.41", "@firebase/webchannel-wrapper": "0.2.36", @@ -191,9 +191,9 @@ } }, "@firebase/firestore-types": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-1.9.2.tgz", - "integrity": "sha512-D264aOrssdbD3PE0JuJdbwBI9zXDTd5HASjJYtYc3AIGC526R+w+TDWes4GsE/zi0dSWqMfgiceVKL0PekjqZw==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-1.10.0.tgz", + "integrity": "sha512-/Pvmu5hpc0pceB96X2mEOAdEB0Xyn6+IQliBl7dUhu23AztnjBq+9uKcsgMB+k34RCApFQfNm1m24E4e+fUSVg==" }, "@firebase/functions": { "version": "0.4.36", @@ -957,9 +957,9 @@ "optional": true }, "dblapi.js": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/dblapi.js/-/dblapi.js-2.3.1.tgz", - "integrity": "sha512-SmaEknbWCPPyPX269hD2EARdkGlMp2PFsgjF8FsnaTLkWagQKtXO+K+aVF6FZqJvRrLIrpjv3y1bhK9KWq+coA==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/dblapi.js/-/dblapi.js-2.4.0.tgz", + "integrity": "sha512-SqDYVcV1DBQnyhySTjd+Qvzu7jFr+4eKwl56fGpIti7OlXGF5dmDPeo3jQfRlOXTRn5/I5997MDIJukoDxE3Mg==" }, "debug": { "version": "4.1.1", @@ -1033,9 +1033,9 @@ } }, "discord.js": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.0.1.tgz", - "integrity": "sha512-lUlrkAWSb5YTB1WpSZHjeUXxGlHK8VDjrlHLEP4lJj+etFAellURpmRYl29OPJ/7arQWB879pP4rvhhzpdOF7w==", + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.0.2.tgz", + "integrity": "sha512-iZiEA4Y61gqq/EjFfLXnkRK9pLapnax/vTVDUhs/mAhyqozAy0GOlk/MZI9rSa1iIoKTWRq6P9CRKhLNT2wUnA==", "requires": { "@discordjs/collection": "^0.1.5", "abort-controller": "^3.0.0", @@ -1056,11 +1056,6 @@ "combined-stream": "^1.0.8", "mime-types": "^2.1.12" } - }, - "prism-media": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.1.tgz", - "integrity": "sha512-R3EbKwJiYlTvGwcG1DpUt+06DsxOGS5W4AMEHT7oVOjG93MjpdhGX1whHyjnqknylLMupKAsKMEXcTNRbPe6Vw==" } } }, @@ -1257,16 +1252,16 @@ } }, "firebase": { - "version": "7.9.3", - "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.9.3.tgz", - "integrity": "sha512-9tIxZvA8/Tf5p7nPMEE9zFklbmwqny4qHxGzwG3Hus4TInkxyYeiGY2L1mNTV+WuTJzQYuo9NtCRZLBnsChpqQ==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.10.0.tgz", + "integrity": "sha512-j80k8wsgg0N/t8uOkpGK6OT1MHHZ3Y/98nyZJJ+6lNodA6O79mXgyvI4AwXlPYd8qfmYeXwHz1f19sC+EqnZZg==", "requires": { - "@firebase/analytics": "0.2.15", + "@firebase/analytics": "0.2.16", "@firebase/app": "0.5.5", "@firebase/app-types": "0.5.2", "@firebase/auth": "0.13.6", "@firebase/database": "0.5.22", - "@firebase/firestore": "1.11.2", + "@firebase/firestore": "1.12.0", "@firebase/functions": "0.4.36", "@firebase/installations": "0.4.4", "@firebase/messaging": "0.6.8", @@ -2823,7 +2818,7 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "prism-media": { - "version": "github:hydrabolt/prism-media#bbf60e0e22f9194586a4b30ffb9f49d20255041c", + "version": "github:hydrabolt/prism-media#56b3dc34435ac320688148bef030b5c6822b7483", "from": "github:hydrabolt/prism-media" }, "process-nextick-args": { @@ -3395,9 +3390,9 @@ } }, "ws": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz", - "integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A==" + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" }, "xdg-basedir": { "version": "4.0.0", diff --git a/package.json b/package.json index 29d6df04..d3b2c415 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "musix", - "version": "3.0.2", + "version": "3.0.3", "description": "V3 for Musix the discord music bot", "main": "./index.js", "scripts": { @@ -18,11 +18,11 @@ "homepage": "https://github.com/MatteZ02/Musix-V3#readme", "dependencies": { "@discordjs/opus": "^0.1.0", - "dblapi.js": "^2.3.1", - "discord.js": "^12.0.1", + "dblapi.js": "^2.4.0", + "discord.js": "^12.0.2", "dotenv": "^8.2.0", "ffmpeg": "0.0.4", - "firebase": "^7.9.3", + "firebase": "^7.10.0", "firebase-admin": "^8.9.2", "fs": "0.0.1-security", "he": "^1.2.0", diff --git a/struct/client.js b/struct/client.js index 42bebb73..641ccd2f 100644 --- a/struct/client.js +++ b/struct/client.js @@ -19,6 +19,7 @@ module.exports = class extends Client { this.funcs = {}; this.dispatcher = {}; this.config = require('./config/config.js'); + this.messages = require('./config/messages.js'); this.dispatcher.finish = require('../events/dispatcher/finish.js'); fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { diff --git a/struct/config/messages.js b/struct/config/messages.js new file mode 100644 index 00000000..b5ab4124 --- /dev/null +++ b/struct/config/messages.js @@ -0,0 +1,92 @@ +/* +THIS FILE CONTAINS ALL MESSAGES THAT MUSIX SENDS! +THIS IS MUSIX BRANDING AND YOU'RE NOT PERMITTED TO COPY ALL THE VISUALS FROM MUSIX! +IF YOU CLONED THIS REPOSITORY PLEASE MODIFY THESE MESSAGES! +*/ +module.exports = { + restart: "restarted!", + reloaded: "All files reloaded!", + validNumber: "<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.", + boolean: "<:redx:674263474704220182> Please define a boolean! (true/false)", + correctUsage: "<:redx:674263474704220182> correct usage: ", + wrongVoiceChannel: "<:redx:674263474704220182> I'm sorry but you need to be in the same voice channel as Musix to use this command!", + noQuery: "<:redx:674263474704220182> You need to use a link or search for a song!", + noResults: "<:redx:674263474704220182> I could not obtain any search results!", + noServerQueue: "<:redx:674263474704220182> There is nothing playing!", + noVoiceChannel: "<:redx:674263474704220182> I\'m sorry but you need to be in a voice channel to play music!", + noDj: "<:redx:674263474704220182> You need the `DJ` role to use this command!", + noPerms: `<:redx:674263474704220182> You need the %PERMS% permission to use this command!`, + noPermsManageSettings: "<:redx:674263474704220182> You need the `MANAGE_SERVER` permission to change the settings!", + noPermsEmbed: "<:redx:674263474704220182> I cannot send embeds (Embed links), make sure I have the proper permissions!", + noPermsUseExternalEmojis: "<:redx:674263474704220182> I cannot use external emojis, make sure I have the proper permissions!", + noPermsConnect: "<:redx:674263474704220182> I cannot connect to your voice channel, make sure I have the proper permissions!", + noPermsSpeak: "<:redx:674263474704220182> I cannot speak in your voice channel, make sure I have the proper permissions!", + noPermsManageRoles: "<:redx:674263474704220182> I cannot create roles (Manage roles), make sure I have the proper permissions! I will need this permission to create a `DJ` role since i did not find one!", + notAllowed: "<:redx:674263474704220182> You are not allowed to do that!", + devMode: "<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!", + error: "<:redx:674263474704220182> An error occured!", + errorExe: "<:redx:674263474704220182> there was an error trying to execute that command! Please contact support with the \`bug\` command!", + errorExeOpt: "<:redx:674263474704220182> there was an error trying to execute that option! Please contact support with the \`bug\` command!", + errorConnecting: "Error with connecting to voice channel: ", + errorDispatcher: "<:redx:674263474704220182> An error has occured while playing music! The queue has been deleted.", + songAdded: "<:green_check_mark:674265384777416705> **%TITLE%** has been added to the queue!", + playlistAdded: "<:green_check_mark:674265384777416705> Playlist: **%TITLE%** has been added to the queue!", + startPlaying: " Start playing: ", + loadingSongs: " Loading song(s)", + prefixHere: "My prefix here is: ", + prefixSet: "<:green_check_mark:674265384777416705> New prefix set to:", + pinging: " Pinging...", + currentVolume: ":loud_sound: The current volume is: ", + currentBass: ":loud_sound: The current bass is: ", + maxVolume: "<:redx:674263474704220182> The max volume is `100`!", + maxBass: "<:redx:674263474704220182> The max bass is `100`!", + positiveVolume: "<:redx:674263474704220182> The volume needs to be a positive number!", + positiveBass: "<:redx:674263474704220182> The bass needs to be a positive number!", + setVolume: "<:volumehigh:674685637626167307> I set the volume to: ", + bassApplied: "<:volumehigh:674685637626167307> The bass level **%BASS%** will be applied when the next song starts playing!", + stop: "<:stop:674685626108477519> Stopped the music!", + noSongs: "'<:redx:674263474704220182> That song does not exist!", + cantSkipToCurrent: "<:redx:674263474704220182> You can\'t skip to the song currently playing!", + skipped: "<:skip:674685614221688832> Skipped the song!", + alreadyVoted: "<:redx:674263474704220182> You have already voted to skip!", + notEnoughVotes: "<:redx:674263474704220182> Not enough votes!", + shuffled: "<:shuffle:674685595980791871> Queue suffled!", + seekingPointPositive: "<:redx:674263474704220182> The seeking point needs to be a positive number!", + seekMax: "<:redx:674263474704220182> The lenght of this song is %LENGTH% seconds! You can't seek further than that!", + songSelection: "__Song Selection__", + nowPlaying: "__Now playing__", + provideANumber: "Please provide a number ranging from 1-10 to select one of the search results.", + cancellingVideoSelection: "'<:redx:674263474704220182> Cancelling video selection", + notPaused: "<:redx:674263474704220182> The music in not paused!", + alreadyPaused: "<:redx:674263474704220182> The music is already paused!", + resumed: "<:resume:674685585478254603> Resumed the music!", + paused: "<:pause:674685548610322462> Paused the music!", + provideASong: "<:redx:674263474704220182> Please provide a song position in queue for me to remove!", + queueLength: "<:redx:674263474704220182> There are only %SONGS% amount of songs in the queue!", + removed: "🗑️ removed \`%SONG%\` from the queue!", + loopingSong: "<:repeatsong:674685573419761716> Looping **%TITLE%** now!", + noLoopingSong: "<:repeatsong:674685573419761716> No longer looping the song!", + looping: "<:repeat1:674685561377914892> Looping the queue now!", + noLooping: "<:repeat1:674685561377914892> No longer looping the queue!", + joined: "<:green_check_mark:674265384777416705> Joined", + queueDeleted: "Queue deleted!", + bug: "Matte#0002\nOr join the support server: https://discord.gg/rvHuJtB", + currentDefaultVolume: ":speaker: Current default volume is:", + defaultVolumeNumber: "<:redx:674263474704220182> I\'m sorry, But the default volume needs to be a valid __number__.", + defaultVolumeMax: "<:redx:674263474704220182> The default volume must be below `100` for quality and safety resons.", + defaultVolumeSet: "<:green_check_mark:674265384777416705> Default volume set to:", + djRoleFound: "<:green_check_mark:674265384777416705> I found a `DJ` role from this guild! This role is now the DJ role.", + djRoleCreated: "<:green_check_mark:674265384777416705> I did not find a role `DJ` so i have created one for you!", + djFalse: "<:green_check_mark:674265384777416705> `DJ` now set to `false`", + reset: "<:green_check_mark:674265384777416705> Reset __all__ guild settings!", + permission: "🔒 Permission requirement:", + permissionsSetTrue: "<:green_check_mark:674265384777416705> Permissions requirement now set to: \`true\`", + permissionsTrue: "<:redx:674263474704220182> That value is already `true`!", + permissionsSetFalse: "<:green_check_mark:674265384777416705> Permissions requirement now set to: \`false\`", + permissionsFalse: "<:redx:674263474704220182> That value is already `false`!", + currentDefaultBass: ":speaker: Currect default bass level:", + bassFalse: "<:green_check_mark:674265384777416705> Bass is now false!", + bassLevel: "<:green_check_mark:674265384777416705> Bass level is now", + announceSongsFalse: "<:green_check_mark:674265384777416705> announcesongs now set to `false`!", + announceSongsTrue: "<:green_check_mark:674265384777416705> announcesongs now set to `true`!" +}; \ No newline at end of file diff --git a/struct/funcs/check.js b/struct/funcs/check.js index 2a5d0e69..27ffbac0 100644 --- a/struct/funcs/check.js +++ b/struct/funcs/check.js @@ -1,17 +1,18 @@ module.exports = function (client, msg, command) { const serverQueue = client.queue.get(msg.guild.id); const permissions = msg.channel.permissionsFor(msg.author); - if (!serverQueue || !serverQueue.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing!'); + if (!serverQueue || !serverQueue.playing) return msg.channel.send(client.messages.noServerQueue); if (msg.author.id !== client.config.devId) { - if (msg.member.voice.channel !== serverQueue.voiceChannel) return msg.channel.send(`<:redx:674263474704220182> I'm sorry but you need to be in the same voice channel as Musix to use this command!`); + if (msg.member.voice.channel !== serverQueue.voiceChannel) return msg.channel.send(client.messages.wrongVoiceChannel); if (client.global.db.guilds[msg.guild.id].permissions === true) { if (client.global.db.guilds[msg.guild.id].dj) { if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole)) { - msg.channel.send('<:redx:674263474704220182> You need the `DJ` role to use this command!'); + msg.channel.send(client.messages.noDj); return false; } else return true; } else if (!permissions.has(command.permission)) { - msg.channel.send(`<:redx:674263474704220182> You need the \`${command.permission}\` permission to use this command!`); + client.messages.noPerms = client.messages.noPerms.replace("%PERMS%", commands.permissions); + msg.channel.send(client.messages.noPerms); return false; } else return true; } else return true; diff --git a/struct/funcs/exe.js b/struct/funcs/exe.js index 65838fd2..2f30a7e7 100644 --- a/struct/funcs/exe.js +++ b/struct/funcs/exe.js @@ -1,13 +1,13 @@ module.exports = function (msg, args, client, Discord, prefix, command) { const permissions = msg.channel.permissionsFor(msg.client.user); - if (!permissions.has('EMBED_LINKS')) return msg.channel.send('<:redx:674263474704220182> I cannot send embeds (Embed links), make sure I have the proper permissions!'); - if (!permissions.has('USE_EXTERNAL_EMOJIS')) return msg.channel.send('<:redx:674263474704220182> I cannot use external emojis, make sure I have the proper permissions!'); + if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed); + if (!permissions.has('USE_EXTERNAL_EMOJIS')) return msg.channel.send(client.noPermsUseExternalEmojis); try { command.uses++; command.execute(msg, args, client, Discord, prefix, command); } catch (error) { const date = new Date(); - msg.reply(`<:redx:674263474704220182> there was an error trying to execute that command! Please contact support with \`${prefix}bug\`!`); + msg.reply(client.messages.errorExe); const embed = new Discord.MessageEmbed() .setTitle(`Musix ${error.toString()}`) .setDescription(error.stack.replace(/at /g, '**at **')) diff --git a/struct/funcs/handleVideo.js b/struct/funcs/handleVideo.js index 8509c9ad..ad9b0734 100644 --- a/struct/funcs/handleVideo.js +++ b/struct/funcs/handleVideo.js @@ -12,7 +12,8 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa if (serverQueue) { serverQueue.songs.push(song); if (playlist) return; - return msg.channel.send(`<:green_check_mark:674265384777416705> **${song.title}** has been added to the queue!`); + client.messages.songsAdded = client.messages.songAdded.replace("%TITLE%", song.title); + return msg.channel.send(client.messages.songAdded); } const construct = require("../config/queueConfig.js"); @@ -32,8 +33,8 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa client.funcs.play(msg.guild, construct.songs[0], client, 0, true); } catch (error) { client.queue.delete(msg.guild.id); - client.debug_channel.send("Error with connecting to voice channel: " + error); - return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`); + client.debug_channel.send(client.messages.errorConnecting + error); + return msg.channel.send(client.messages.error); } return; } diff --git a/struct/funcs/play.js b/struct/funcs/play.js index 7be9240c..fd63048c 100644 --- a/struct/funcs/play.js +++ b/struct/funcs/play.js @@ -22,7 +22,7 @@ module.exports = async function (guild, song, client, seek, play) { client.debug_channel.send('Error with the dispatcher: ' + error); serverQueue.voiceChannel.leave(); client.queue.delete(guild.id); - return serverQueue.textChannel.send('<:redx:674263474704220182> An error has occured while playing music! The queue has been deleted.'); + return serverQueue.textChannel.send(client.messages.errorDispatcher); }); dispatcher.setVolume(serverQueue.volume / 10); if (client.global.db.guilds[guild.id].startPlaying || play) { @@ -30,7 +30,7 @@ module.exports = async function (guild, song, client, seek, play) { const songtime = (data.length_seconds * 1000).toFixed(0); const thumbnail = getThumb(serverQueue.songs[0].url); const embed = new Discord.MessageEmbed() - .setTitle(` Start playing: **${song.title}**`) + .setTitle(`${client.messages.startPlaying}**${song.title}**`) .setDescription(`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``) .setThumbnail(thumbnail._rejectionHandler0) .setColor(client.config.embedColor) diff --git a/struct/funcs/urlMatch.js b/struct/funcs/urlMatch.js index 125fbaed..635315ef 100644 --- a/struct/funcs/urlMatch.js +++ b/struct/funcs/urlMatch.js @@ -1,16 +1,16 @@ module.exports = async function (client, msg, youtube, voiceChannel, url) { if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { - const lmsg = await msg.channel.send(' Loading song(s)'); + const lmsg = await msg.channel.send(client.messages.loadingSongs); const playlist = await youtube.getPlaylist(url); const videos = await playlist.getVideos(); for (const video of Object.values(videos)) { const video2 = await youtube.getVideoByID(video.id); await client.funcs.handleVideo(video2, msg, voiceChannel, client, true); } - lmsg.edit(`<:green_check_mark:674265384777416705> Playlist: **${playlist.title}** has been added to the queue!`); + client.messages.playlistAdded = client.messages.playlistAdded.replace("%TITLE%", playlist.title); + lmsg.edit(client.messages.playlistAdded); return true; } else { - console.log('return false') return false; } }; \ No newline at end of file