1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 01:16:00 +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

@ -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;

View File

@ -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 **'))

View File

@ -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;
}

View File

@ -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(`<a:aNotes:674602408105476106> 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)

View File

@ -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('<a:loading:674284196700618783> 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;
}
};