1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 06:43:17 +00:00

Update 3.0.3

All messages reworked.
This commit is contained in:
MatteZ02 2020-03-12 13:56:31 +02:00
parent f985744170
commit a64f9d2325
40 changed files with 249 additions and 157 deletions

View File

@ -9,14 +9,15 @@ module.exports = {
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); 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]); const bass = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) { 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 (isNaN(bass)) return msg.channel.send(client.messages.validNumber);
if (bass > 100) return msg.channel.send('<:redx:674263474704220182> The max bass is `100`!'); if (bass > 100) return msg.channel.send(client.messages.maxBass);
if (bass < 0) return msg.channel.send('<:redx:674263474704220182> The volume needs to be a positive number!'); if (bass < 0) return msg.channel.send(client.messages.positiveBass);
serverQueue.bass = bass; 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);
} }
} }
}; };

View File

@ -9,7 +9,7 @@ module.exports = {
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client, Discord, prefix) {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`) .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); .setColor(client.config.embedColor);
msg.channel.send(embed); msg.channel.send(embed);
}, },

View File

@ -8,6 +8,6 @@ module.exports = {
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, prefix, command) {
client.queue.delete(msg.guild.id); client.queue.delete(msg.guild.id);
msg.channel.send('Queue deleted!'); msg.channel.send(client.messages.queueDeleted);
} }
}; };

View File

@ -14,11 +14,11 @@ module.exports = {
if (serverQueue) { if (serverQueue) {
serverQueue.connection = connection; serverQueue.connection = connection;
} }
msg.channel.send(`<:green_check_mark:674265384777416705> Joined ${voiceChannel.name}!`); msg.channel.send(`${client.messages.joined} ${voiceChannel.name}!`);
} catch (error) { } catch (error) {
client.queue.delete(msg.guild.id); client.queue.delete(msg.guild.id);
client.channels.get(client.config.debug_channel).send("Error with connecting to voice channel: " + error); client.channels.get(client.config.debug_channel).send(client.messages.errorConnecting + error);
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`); return msg.channel.send(client.messages.error);
} }
} }
}; };

View File

@ -11,10 +11,10 @@ module.exports = {
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (!serverQueue.looping) { if (!serverQueue.looping) {
serverQueue.looping = true; serverQueue.looping = true;
msg.channel.send('<:repeat1:674685561377914892> Looping the queue now!'); msg.channel.send(client.messages.looping);
} else { } else {
serverQueue.looping = false; serverQueue.looping = false;
msg.channel.send('<:repeat1:674685561377914892> No longer looping the queue!'); msg.channel.send(client.messages.noLooping);
} }
} }
} }

View File

@ -11,10 +11,11 @@ module.exports = {
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (!serverQueue.songLooping) { if (!serverQueue.songLooping) {
serverQueue.songLooping = true; 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 { } else {
serverQueue.songLooping = false; serverQueue.songLooping = false;
msg.channel.send('<:repeatsong:674685573419761716> No longer looping the song!'); msg.channel.send(client.messages.noLoopingSong);
} }
} }
} }

View File

@ -10,8 +10,7 @@ module.exports = {
const getThumb = require('video-thumbnail-url'); const getThumb = require('video-thumbnail-url');
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (!serverQueue) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.'); if (!serverQueue || !serverQueue.playing) return msg.channel.send(client.messages.noServerQueue);
if (!serverQueue.playing) return msg.channel.send('<:redx:674263474704220182> There is nothing playing.');
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
let songtime = (data.length_seconds * 1000).toFixed(0); let songtime = (data.length_seconds * 1000).toFixed(0);
serverQueue.time = serverQueue.connection.dispatcher.streamTime; 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('⎯'); } 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 thumbnail = getThumb(serverQueue.songs[0].url);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle("__Now playing__") .setTitle(client.messages.nowPlaying)
.setDescription(`<a:aNotes:674602408105476106>**Now playing:** ${serverQueue.songs[0].title}\n${array.join('')} | \`${client.funcs.msToTime(completed, "hh:mm:ss")} / ${client.funcs.msToTime(songtime, "hh:mm:ss")}\``) .setDescription(`<a:aNotes:674602408105476106>**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}`) .setFooter(`Queued by ${serverQueue.songs[0].author.tag}`)
.setURL(serverQueue.songs[0].url) .setURL(serverQueue.songs[0].url)

View File

@ -9,10 +9,10 @@ module.exports = {
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { 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.paused = true;
serverQueue.connection.dispatcher.pause(true); serverQueue.connection.dispatcher.pause(true);
return msg.channel.send('<:pause:674685548610322462> Paused the music!'); return msg.channel.send(client.messages.paused);
} }
} }
}; };

View File

@ -15,31 +15,28 @@ module.exports = {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel; const voiceChannel = msg.member.voice.channel;
if (!serverQueue) { 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 { } 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); const permissions = voiceChannel.permissionsFor(msg.client.user);
if (!permissions.has('CONNECT')) { 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')) { 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(.*)$/)) { if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const lmsg = await msg.channel.send('<a:loading:674284196700618783> Loading song(s)'); const lmsg = await msg.channel.send(client.messages.loadingSongs);
const playlist = await youtube.getPlaylist(url); const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos(); const videos = await playlist.getVideos();
for (const video of Object.values(videos)) { for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id) 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!`);
});
await client.funcs.handleVideo(video2, msg, voiceChannel, client, true); 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 { } else {
try { try {
var video = await youtube.getVideo(url); var video = await youtube.getVideo(url);
@ -49,7 +46,7 @@ module.exports = {
var video = await youtube.getVideoByID(videos[0].id); var video = await youtube.getVideoByID(videos[0].id);
} catch (err) { } catch (err) {
console.error(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); return client.funcs.handleVideo(video, msg, voiceChannel, client, false);

View File

@ -8,9 +8,9 @@ module.exports = {
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client, Discord, prefix) {
const serverQueue = client.queue.get(msg.guild.id); 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 (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]); let page = parseInt(args[1]);
if (!page) page = 1; if (!page) page = 1;

View File

@ -25,6 +25,6 @@ module.exports = {
/*fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { /*fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
this.funcs[filename.slice(0, -3)] = require(`../struct/funcs/${filename}`); this.funcs[filename.slice(0, -3)] = require(`../struct/funcs/${filename}`);
});*/ });*/
msg.channel.send('All files reloaded!'); msg.channel.send(client.messages.reloaded);
} }
}; };

View File

@ -9,12 +9,14 @@ module.exports = {
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { 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]); const pos = parseInt(args[1]);
if (isNaN(pos)) return msg.channel.send('<:redx:674263474704220182> You need to enter a number!'); if (isNaN(pos)) return msg.channel.send(client.messages.validNumber);
if (pos < 1) return msg.channel.send('<:redx:674263474704220182> That songs does not exist!'); if (pos < 1) return msg.channel.send(client.messages.noSongs);
if (pos > serverQueue.songs.length) return msg.channel.send(`<:redx:674263474704220182> There is only ${serverQueue.songs.length} amount of songs in the queue!`); client.messages.queueLength = client.messages.queueLength.replace("%LENGTH%", serverQueue.songs.length);
msg.channel.send(`🗑️ removed \`${serverQueue.songs[pos].title}\` from the queue!`); 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); return serverQueue.songs.splice(pos, 1);
} }
} }

View File

@ -9,6 +9,6 @@ module.exports = {
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, prefix, command) {
client.destroy(); client.destroy();
require('../index.js'); require('../index.js');
msg.channel.send('restarted!'); msg.channel.send(client.messages.restart);
} }
}; };

View File

@ -9,10 +9,10 @@ module.exports = {
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { 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.paused = false;
serverQueue.connection.dispatcher.resume(true); serverQueue.connection.dispatcher.resume(true);
return msg.channel.send('<:resume:674685585478254603> Resumed the music!'); return msg.channel.send(client.messages.resumed);
} }
} }
}; };

View File

@ -16,27 +16,28 @@ module.exports = {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel; const voiceChannel = msg.member.voice.channel;
if (!serverQueue) { 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 { } 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); const permissions = voiceChannel.permissionsFor(msg.client.user);
if (!permissions.has('CONNECT')) { 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')) { 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(.*)$/)) { if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const lmsg = await msg.channel.send('<a:loading:674284196700618783> Loading song(s)'); const lmsg = await msg.channel.send(client.messages.loadingSongs);
const playlist = await youtube.getPlaylist(url); const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos(); const videos = await playlist.getVideos();
for (const video of Object.values(videos)) { for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); const video2 = await youtube.getVideoByID(video.id);
await client.funcs.handleVideo(video2, msg, voiceChannel, client, true); 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 { } else {
try { try {
var video = await youtube.getVideo(url); var video = await youtube.getVideo(url);
@ -45,9 +46,9 @@ module.exports = {
var videos = await youtube.searchVideos(searchString, 10); var videos = await youtube.searchVideos(searchString, 10);
let index = 0; let index = 0;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle("__Song Selection__") .setTitle(client.messages.songSelection)
.setDescription(`${videos.map(video2 => `**${++index}** ${he.decode(video2.title)} `).join('\n')}`) .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) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
try { try {
@ -58,13 +59,13 @@ module.exports = {
}); });
} catch (err) { } catch (err) {
console.error(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); const videoIndex = parseInt(response.first().content);
var video = await youtube.getVideoByID(videos[videoIndex - 1].id); var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
} catch (err) { } catch (err) {
console.error(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); return client.funcs.handleVideo(video, msg, voiceChannel, client, false);

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
name: 'seek', name: 'seek',
alias: 'none', alias: 'none',
usage: '<point in song(seconds)>', usage: '<point in song>',
description: 'Seek to a specific point in the currently playing song.', description: 'Seek to a specific point in the currently playing song.',
onlyDev: true, onlyDev: true,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
@ -11,12 +11,13 @@ module.exports = {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
if (!args[1]) return msg.channel.send(`<:redx:674263474704220182> Correct usage: \`${prefix}seek <seeking point in seconds>\``); if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${prefix}seek ${command.usage}\``);
let point = args[1]; let point = args[1];
const pos = parseInt(args[1]); const pos = parseInt(args[1]);
if (isNaN(pos)) { if (isNaN(pos)) {
if (pos < 0) return msg.channel.send('<:redx:674263474704220182> The seeking point needs to be a positive number!'); if (pos < 0) return msg.channel.send(client.messages.seekingPointPositive);
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!`); 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; point = pos;
} }
serverQueue.connection.dispatcher.end(); serverQueue.connection.dispatcher.end();

View File

@ -20,7 +20,7 @@ module.exports = {
.setColor(client.embedColor) .setColor(client.embedColor)
const permissions = msg.channel.permissionsFor(msg.author); const permissions = msg.channel.permissionsFor(msg.author);
if (msg.author.id !== client.config.devId) { 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]) { if (args[1]) {
const optionName = args[1].toLowerCase(); const optionName = args[1].toLowerCase();
@ -29,7 +29,7 @@ module.exports = {
try { try {
option.execute(msg, args, client, Discord, prefix); option.execute(msg, args, client, Discord, prefix);
} catch (error) { } 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() const embed = new Discord.MessageEmbed()
.setTitle(`Musix ${error.toString()}`) .setTitle(`Musix ${error.toString()}`)
.setDescription(error.stack.replace(/at /g, '**at **')) .setDescription(error.stack.replace(/at /g, '**at **'))

View File

@ -3,10 +3,10 @@ module.exports = {
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client, Discord, prefix) {
if (client.global.db.guilds[msg.guild.id].startPlaying) { if (client.global.db.guilds[msg.guild.id].startPlaying) {
client.global.db.guilds[msg.guild.id].startPlaying = false; 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 { } else {
client.global.db.guilds[msg.guild.id].startPlaying = true; 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);
} }
} }
}; };

View File

@ -1,14 +1,14 @@
module.exports = { module.exports = {
name: 'bass', name: 'bass',
async execute(msg, args, client, Discord, prefix) { 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") { if (args[2] === "false") {
client.global.db.guilds[msg.guild.id].bass = 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]); 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; client.global.db.guilds[msg.guild.id].bass = level;
msg.channel.send(`Bass level is now ${level}!`); msg.channel.send(`${client.messages.bassLevel} ${level}!`);
} }
}; };

View File

@ -1,17 +1,17 @@
module.exports = { module.exports = {
name: 'permissions', name: 'permissions',
async execute(msg, args, client, Discord, prefix) { 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 (args[2] === 'true') {
if (!client.global.db.guilds[msg.guild.id].permissions) { if (!client.global.db.guilds[msg.guild.id].permissions) {
client.global.db.guilds[msg.guild.id].permissions = true; client.global.db.guilds[msg.guild.id].permissions = true;
msg.channel.send(`<:green_check_mark:674265384777416705> Permissions requirement now set to: \`true\``); msg.channel.send(client.messages.permissionsSetTrue);
} else return msg.channel.send('<:redx:674263474704220182> That value is already `true`!'); } else return msg.channel.send(client.messages.permissionsTrue);
} else if (args[2] === 'false') { } else if (args[2] === 'false') {
if (client.global.db.guilds[msg.guild.id].permissions) { if (client.global.db.guilds[msg.guild.id].permissions) {
client.global.db.guilds[msg.guild.id].permissions = false; client.global.db.guilds[msg.guild.id].permissions = false;
msg.channel.send(`<:green_check_mark:674265384777416705> Permissions requirement now set to: \`false\``); msg.channel.send(client.messages.permissionsSetFalse);
} else return msg.channel.send('<:redx:674263474704220182> That value is already `false`!'); } else return msg.channel.send(client.messages.permissionsFalse);
} else return msg.channel.send('<:redx:674263474704220182> Please define a boolean! (true/false)'); } else return msg.channel.send(client.messages.boolean);
} }
}; };

View File

@ -3,6 +3,6 @@ module.exports = {
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client, Discord, prefix) {
if (!args[2]) return msg.channel.send(`Current prefix: \`${client.global.db.guilds[msg.guild.id].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]; 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]}\``);
} }
}; };

View File

@ -9,6 +9,6 @@ module.exports = {
dj: false, dj: false,
djrole: null djrole: null
}; };
msg.channel.send('<:green_check_mark:674265384777416705> Reset __all__ guild settings!'); msg.channel.send(client.messages.reset);
} }
}; };

View File

@ -7,22 +7,22 @@ module.exports = {
} }
if (msg.guild.roles.cache.find(x => x.name === "DJ")) { 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; 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; client.global.db.guilds[msg.guild.id].dj = true;
} else { } else {
const permissions = msg.channel.permissionsFor(msg.client.user); 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({ msg.guild.createRole({
name: 'DJ', name: 'DJ',
}) })
.then(role => client.global.db.guilds[msg.guild.id].djrole = role.id) .then(role => client.global.db.guilds[msg.guild.id].djrole = role.id)
.catch(console.error) .catch(console.error)
client.global.db.guilds[msg.guild.id].dj = true; 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 { } else {
client.global.db.guilds[msg.guild.id].dj = false; 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);
} }
} }
}; };

View File

@ -1,10 +1,10 @@
module.exports = { module.exports = {
name: 'volume', name: 'volume',
async execute(msg, args, client, Discord, prefix) { 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 (!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('<:redx:674263474704220182> I\'m sorry, But the default volume needs to be a valid __number__.'); if (isNaN(args[2])) return msg.channel.send(client.messages.defaultVolumeNumber);
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].length > 2) return msg.channel.send(client.messages.defaultVolumeMax);
client.global.db.guilds[msg.guild.id].defaultVolume = args[2]; 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]}\``);
} }
}; };

View File

@ -10,7 +10,7 @@ module.exports = {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
client.funcs.shuffle(serverQueue.songs); client.funcs.shuffle(serverQueue.songs);
msg.channel.send('<:shuffle:674685595980791871> Queue suffled!'); msg.channel.send(client.messages.shuffled);
} }
} }
}; };

View File

@ -9,33 +9,33 @@ module.exports = {
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author); 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.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 (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)) { if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole) || !permissions.has(command.permission)) {
return vote(serverQueue, msg, client); return vote(serverQueue, msg, client);
} else { } else {
return skipSong(serverQueue, msg); return skipSong(serverQueue, msg, client);
} }
} else { } else {
return skipSong(serverQueue, msg); return skipSong(serverQueue, msg, client);
} }
} else { } else {
return skipSong(serverQueue, msg); return skipSong(serverQueue, msg, client);
} }
} }
}; };
function skipSong(serverQueue, msg) { function skipSong(serverQueue, msg, client) {
msg.channel.send('<:skip:674685614221688832> Skipped the song!'); msg.channel.send(client.messages.skipped);
serverQueue.endReason = "skip"; serverQueue.endReason = "skip";
serverQueue.connection.dispatcher.end(); serverQueue.connection.dispatcher.end();
}; };
function vote(serverQueue, msg) { function vote(serverQueue, msg, client) {
serverQueue.votesNeeded = Math.floor(serverQueue.voiceChannel.members.size / 2); serverQueue.votesNeeded = Math.floor(serverQueue.voiceChannel.members.size / 2);
serverQueue.votesNeeded.toFixed(); serverQueue.votesNeeded.toFixed();
if (serverQueue.voiceChannel.members.size > 2) { 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.votes++;
serverQueue.voters.push(msg.member.id); serverQueue.voters.push(msg.member.id);
if (serverQueue.votes >= serverQueue.votesNeeded) { if (serverQueue.votes >= serverQueue.votesNeeded) {
@ -43,7 +43,7 @@ function vote(serverQueue, msg) {
serverQueue.votes = 0; serverQueue.votes = 0;
serverQueue.votesNeeded = null; serverQueue.votesNeeded = null;
return skipSong(serverQueue, msg); 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 { } else {
return skipSong(serverQueue, msg); return skipSong(serverQueue, msg);
} }

View File

@ -9,11 +9,11 @@ module.exports = {
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { 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); 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 (isNaN(point)) return msg.channel.send(client.messages.validNumber);
if (point > serverQueue.songs.size) return msg.channel.send('<:redx:674263474704220182> That song does not exist!'); if (point > serverQueue.songs.size) return msg.channel.send(client.messages.noSongs);
if (point < 1) return msg.channel.send('<:redx:674263474704220182> You can\'t skip to the song currently playing!'); if (point < 1) return msg.channel.send(client.messages.cantSkipToCurrent);
let i = 0; let i = 0;
while (i < point) { while (i < point) {
i++; i++;

View File

@ -8,7 +8,7 @@ module.exports = {
category: 'info', category: 'info',
execute(msg, args, client, Discord, prefix) { execute(msg, args, client, Discord, prefix) {
const uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss"); const uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss");
msg.channel.send('<a:loading:674284196700618783> Pinging...').then(m => { msg.channel.send(client.messages.pinging).then(m => {
const latency = m.createdTimestamp - msg.createdTimestamp; const latency = m.createdTimestamp - msg.createdTimestamp;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()

View File

@ -13,7 +13,7 @@ module.exports = {
serverQueue.looping = false; serverQueue.looping = false;
serverQueue.endReason = "stop"; serverQueue.endReason = "stop";
serverQueue.connection.dispatcher.end(); serverQueue.connection.dispatcher.end();
msg.channel.send('<:stop:674685626108477519> Stopped the music!') msg.channel.send(client.messages.stop)
} }
} }
}; };

View File

@ -9,15 +9,15 @@ module.exports = {
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id); 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]); const volume = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) { 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 (isNaN(volume)) return msg.channel.send(client.messages.validNumber);
if (volume > 100) return msg.channel.send('<:redx:674263474704220182> The max volume is `100`!'); if (volume > 100) return msg.channel.send(client.messages.maxVolume);
if (volume < 0) return msg.channel.send('<:redx:674263474704220182> The volume needs to be a positive number!'); if (volume < 0) return msg.channel.send(client.messages.positiveVolume);
serverQueue.volume = volume; serverQueue.volume = volume;
serverQueue.connection.dispatcher.setVolume(volume / 5); 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}**`);
} }
} }
}; };

View File

@ -8,7 +8,7 @@ module.exports = {
if (msg.mentions.users.first()) { if (msg.mentions.users.first()) {
if (msg.mentions.users.first().id === client.user.id) { if (msg.mentions.users.first().id === client.user.id) {
if (!args[1]) return; 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') { if (args[1] === 'help') {
const command = client.commands.get("help"); const command = client.commands.get("help");
return client.funcs.exe(msg, args, client, Discord, prefix, command); return client.funcs.exe(msg, args, client, Discord, prefix, command);
@ -21,8 +21,8 @@ module.exports = {
if (commandName === "none") return; if (commandName === "none") return;
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName); 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 && 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 (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('<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!'); 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); client.funcs.exe(msg, args, client, Discord, prefix, command);
} }
} }

57
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "musix", "name": "musix",
"version": "3.0.2", "version": "3.0.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -19,9 +19,9 @@
} }
}, },
"@firebase/analytics": { "@firebase/analytics": {
"version": "0.2.15", "version": "0.2.16",
"resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.2.15.tgz", "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.2.16.tgz",
"integrity": "sha512-pNRyLU6PndZa0iO+HN+GwY1HobsyU584a1KN5ZWBuwaqbUOB/99uChn2n6XaPrlD/G07uzv6dpw558IQXahhow==", "integrity": "sha512-t4lwd8SxigKULvt8a+VA1cVj7Aml/tUNECV9vzz3G9wusxDE76d7rTw+HexKTNPRbD2E9+JtRKUVPKlJpox9bw==",
"requires": { "requires": {
"@firebase/analytics-types": "0.2.7", "@firebase/analytics-types": "0.2.7",
"@firebase/component": "0.1.6", "@firebase/component": "0.1.6",
@ -152,12 +152,12 @@
} }
}, },
"@firebase/firestore": { "@firebase/firestore": {
"version": "1.11.2", "version": "1.12.0",
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.11.2.tgz", "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.12.0.tgz",
"integrity": "sha512-WWTKQGUYvZ7BELzEeIhINVm+iKL2ki/f0y16Qc3kABCW4kdXtiUHak6uWMFQ3IXHtnpDGzcNTyDAKOWeZx+TzA==", "integrity": "sha512-GWFU3pPs0xyp2ynFQIyvlmTtg4goGvOkT/lhVCu/Bq6/78xbl395nCPBMjF7IpUl+aVqQVUCwtF/cxrtNXgjMA==",
"requires": { "requires": {
"@firebase/component": "0.1.6", "@firebase/component": "0.1.6",
"@firebase/firestore-types": "1.9.2", "@firebase/firestore-types": "1.10.0",
"@firebase/logger": "0.1.36", "@firebase/logger": "0.1.36",
"@firebase/util": "0.2.41", "@firebase/util": "0.2.41",
"@firebase/webchannel-wrapper": "0.2.36", "@firebase/webchannel-wrapper": "0.2.36",
@ -191,9 +191,9 @@
} }
}, },
"@firebase/firestore-types": { "@firebase/firestore-types": {
"version": "1.9.2", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-1.9.2.tgz", "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-1.10.0.tgz",
"integrity": "sha512-D264aOrssdbD3PE0JuJdbwBI9zXDTd5HASjJYtYc3AIGC526R+w+TDWes4GsE/zi0dSWqMfgiceVKL0PekjqZw==" "integrity": "sha512-/Pvmu5hpc0pceB96X2mEOAdEB0Xyn6+IQliBl7dUhu23AztnjBq+9uKcsgMB+k34RCApFQfNm1m24E4e+fUSVg=="
}, },
"@firebase/functions": { "@firebase/functions": {
"version": "0.4.36", "version": "0.4.36",
@ -957,9 +957,9 @@
"optional": true "optional": true
}, },
"dblapi.js": { "dblapi.js": {
"version": "2.3.1", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/dblapi.js/-/dblapi.js-2.3.1.tgz", "resolved": "https://registry.npmjs.org/dblapi.js/-/dblapi.js-2.4.0.tgz",
"integrity": "sha512-SmaEknbWCPPyPX269hD2EARdkGlMp2PFsgjF8FsnaTLkWagQKtXO+K+aVF6FZqJvRrLIrpjv3y1bhK9KWq+coA==" "integrity": "sha512-SqDYVcV1DBQnyhySTjd+Qvzu7jFr+4eKwl56fGpIti7OlXGF5dmDPeo3jQfRlOXTRn5/I5997MDIJukoDxE3Mg=="
}, },
"debug": { "debug": {
"version": "4.1.1", "version": "4.1.1",
@ -1033,9 +1033,9 @@
} }
}, },
"discord.js": { "discord.js": {
"version": "12.0.1", "version": "12.0.2",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.0.1.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.0.2.tgz",
"integrity": "sha512-lUlrkAWSb5YTB1WpSZHjeUXxGlHK8VDjrlHLEP4lJj+etFAellURpmRYl29OPJ/7arQWB879pP4rvhhzpdOF7w==", "integrity": "sha512-iZiEA4Y61gqq/EjFfLXnkRK9pLapnax/vTVDUhs/mAhyqozAy0GOlk/MZI9rSa1iIoKTWRq6P9CRKhLNT2wUnA==",
"requires": { "requires": {
"@discordjs/collection": "^0.1.5", "@discordjs/collection": "^0.1.5",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
@ -1056,11 +1056,6 @@
"combined-stream": "^1.0.8", "combined-stream": "^1.0.8",
"mime-types": "^2.1.12" "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": { "firebase": {
"version": "7.9.3", "version": "7.10.0",
"resolved": "https://registry.npmjs.org/firebase/-/firebase-7.9.3.tgz", "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.10.0.tgz",
"integrity": "sha512-9tIxZvA8/Tf5p7nPMEE9zFklbmwqny4qHxGzwG3Hus4TInkxyYeiGY2L1mNTV+WuTJzQYuo9NtCRZLBnsChpqQ==", "integrity": "sha512-j80k8wsgg0N/t8uOkpGK6OT1MHHZ3Y/98nyZJJ+6lNodA6O79mXgyvI4AwXlPYd8qfmYeXwHz1f19sC+EqnZZg==",
"requires": { "requires": {
"@firebase/analytics": "0.2.15", "@firebase/analytics": "0.2.16",
"@firebase/app": "0.5.5", "@firebase/app": "0.5.5",
"@firebase/app-types": "0.5.2", "@firebase/app-types": "0.5.2",
"@firebase/auth": "0.13.6", "@firebase/auth": "0.13.6",
"@firebase/database": "0.5.22", "@firebase/database": "0.5.22",
"@firebase/firestore": "1.11.2", "@firebase/firestore": "1.12.0",
"@firebase/functions": "0.4.36", "@firebase/functions": "0.4.36",
"@firebase/installations": "0.4.4", "@firebase/installations": "0.4.4",
"@firebase/messaging": "0.6.8", "@firebase/messaging": "0.6.8",
@ -2823,7 +2818,7 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
}, },
"prism-media": { "prism-media": {
"version": "github:hydrabolt/prism-media#bbf60e0e22f9194586a4b30ffb9f49d20255041c", "version": "github:hydrabolt/prism-media#56b3dc34435ac320688148bef030b5c6822b7483",
"from": "github:hydrabolt/prism-media" "from": "github:hydrabolt/prism-media"
}, },
"process-nextick-args": { "process-nextick-args": {
@ -3395,9 +3390,9 @@
} }
}, },
"ws": { "ws": {
"version": "7.2.1", "version": "7.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz",
"integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A==" "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ=="
}, },
"xdg-basedir": { "xdg-basedir": {
"version": "4.0.0", "version": "4.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "musix", "name": "musix",
"version": "3.0.2", "version": "3.0.3",
"description": "V3 for Musix the discord music bot", "description": "V3 for Musix the discord music bot",
"main": "./index.js", "main": "./index.js",
"scripts": { "scripts": {
@ -18,11 +18,11 @@
"homepage": "https://github.com/MatteZ02/Musix-V3#readme", "homepage": "https://github.com/MatteZ02/Musix-V3#readme",
"dependencies": { "dependencies": {
"@discordjs/opus": "^0.1.0", "@discordjs/opus": "^0.1.0",
"dblapi.js": "^2.3.1", "dblapi.js": "^2.4.0",
"discord.js": "^12.0.1", "discord.js": "^12.0.2",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"ffmpeg": "0.0.4", "ffmpeg": "0.0.4",
"firebase": "^7.9.3", "firebase": "^7.10.0",
"firebase-admin": "^8.9.2", "firebase-admin": "^8.9.2",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"he": "^1.2.0", "he": "^1.2.0",

View File

@ -19,6 +19,7 @@ module.exports = class extends Client {
this.funcs = {}; this.funcs = {};
this.dispatcher = {}; this.dispatcher = {};
this.config = require('./config/config.js'); this.config = require('./config/config.js');
this.messages = require('./config/messages.js');
this.dispatcher.finish = require('../events/dispatcher/finish.js'); this.dispatcher.finish = require('../events/dispatcher/finish.js');
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {

92
struct/config/messages.js Normal file
View File

@ -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: "<a:aNotes:674602408105476106> Start playing: ",
loadingSongs: "<a:loading:674284196700618783> Loading song(s)",
prefixHere: "My prefix here is: ",
prefixSet: "<:green_check_mark:674265384777416705> New prefix set to:",
pinging: "<a:loading:674284196700618783> 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`!"
};

View File

@ -1,17 +1,18 @@
module.exports = function (client, msg, command) { module.exports = function (client, msg, command) {
const serverQueue = client.queue.get(msg.guild.id); const serverQueue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author); 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.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].permissions === true) {
if (client.global.db.guilds[msg.guild.id].dj) { if (client.global.db.guilds[msg.guild.id].dj) {
if (!msg.member.roles.cache.has(client.global.db.guilds[msg.guild.id].djrole)) { 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; return false;
} else return true; } else return true;
} else if (!permissions.has(command.permission)) { } 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; return false;
} else return true; } else return true;
} else return true; } else return true;

View File

@ -1,13 +1,13 @@
module.exports = function (msg, args, client, Discord, prefix, command) { module.exports = function (msg, args, client, Discord, prefix, command) {
const permissions = msg.channel.permissionsFor(msg.client.user); 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('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
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('USE_EXTERNAL_EMOJIS')) return msg.channel.send(client.noPermsUseExternalEmojis);
try { try {
command.uses++; command.uses++;
command.execute(msg, args, client, Discord, prefix, command); command.execute(msg, args, client, Discord, prefix, command);
} catch (error) { } catch (error) {
const date = new Date(); 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() const embed = new Discord.MessageEmbed()
.setTitle(`Musix ${error.toString()}`) .setTitle(`Musix ${error.toString()}`)
.setDescription(error.stack.replace(/at /g, '**at **')) .setDescription(error.stack.replace(/at /g, '**at **'))

View File

@ -12,7 +12,8 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa
if (serverQueue) { if (serverQueue) {
serverQueue.songs.push(song); serverQueue.songs.push(song);
if (playlist) return; 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"); 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); client.funcs.play(msg.guild, construct.songs[0], client, 0, true);
} catch (error) { } catch (error) {
client.queue.delete(msg.guild.id); client.queue.delete(msg.guild.id);
client.debug_channel.send("Error with connecting to voice channel: " + error); client.debug_channel.send(client.messages.errorConnecting + error);
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`); return msg.channel.send(client.messages.error);
} }
return; return;
} }

View File

@ -22,7 +22,7 @@ module.exports = async function (guild, song, client, seek, play) {
client.debug_channel.send('Error with the dispatcher: ' + error); client.debug_channel.send('Error with the dispatcher: ' + error);
serverQueue.voiceChannel.leave(); serverQueue.voiceChannel.leave();
client.queue.delete(guild.id); 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); dispatcher.setVolume(serverQueue.volume / 10);
if (client.global.db.guilds[guild.id].startPlaying || play) { 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 songtime = (data.length_seconds * 1000).toFixed(0);
const thumbnail = getThumb(serverQueue.songs[0].url); const thumbnail = getThumb(serverQueue.songs[0].url);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(`<a:aNotes:674602408105476106> Start playing: **${song.title}**`) .setTitle(`${client.messages.startPlaying}**${song.title}**`)
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``) .setDescription(`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``)
.setThumbnail(thumbnail._rejectionHandler0) .setThumbnail(thumbnail._rejectionHandler0)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -1,16 +1,16 @@
module.exports = async function (client, msg, youtube, voiceChannel, url) { module.exports = async function (client, msg, youtube, voiceChannel, url) {
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const lmsg = await msg.channel.send('<a:loading:674284196700618783> Loading song(s)'); const lmsg = await msg.channel.send(client.messages.loadingSongs);
const playlist = await youtube.getPlaylist(url); const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos(); const videos = await playlist.getVideos();
for (const video of Object.values(videos)) { for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); const video2 = await youtube.getVideoByID(video.id);
await client.funcs.handleVideo(video2, msg, voiceChannel, client, true); 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; return true;
} else { } else {
console.log('return false')
return false; return false;
} }
}; };