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

Fixed some errors and messages

This commit is contained in:
MatteZ02 2020-03-13 16:20:23 +02:00
parent e15e81d9fe
commit 34a5d26829
14 changed files with 69 additions and 64 deletions

View File

@ -16,8 +16,9 @@ module.exports = {
if (bass > 100) return msg.channel.send(client.messages.maxBass); if (bass > 100) return msg.channel.send(client.messages.maxBass);
if (bass < 0) return msg.channel.send(client.messages.positiveBass); if (bass < 0) return msg.channel.send(client.messages.positiveBass);
serverQueue.bass = bass; serverQueue.bass = bass;
client.messages.bassApplied = client.messages.bassApplied.replace("%BASS%", bass); let message;
return msg.channel.send(client.messages.bassApplied); message = client.messages.bassApplied.replace("%BASS%", bass);
return msg.channel.send(message);
} }
} }
}; };

View File

@ -25,11 +25,12 @@ module.exports = {
for (let i = 0; i < categories.length; i++) { for (let i = 0; i < categories.length; i++) {
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp && !x.onlyDev).map(x => `\`${x.name}\``).join(', ')}\n`; commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp && !x.onlyDev).map(x => `\`${x.name}\``).join(', ')}\n`;
} }
client.messages.help = client.messages.help.replace("%PREFIX%", prefix); let message;
message = client.messages.helpFooter.replace("%PREFIX%", prefix);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(`${client.user.username} ${client.messages.help}`) .setTitle(`${client.user.username} ${client.messages.helpTitle}`)
.setDescription(commands) .setDescription(commands)
.setFooter(client.messages.helpFooter) .setFooter(message)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
} }

View File

@ -11,11 +11,12 @@ 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;
client.messages.loopingSong = client.messages.loopingSong.replace("%TITLE%", serverQueue.songs[0].title); let message;
msg.channel.send(client.messages.loopingSong); message = client.messages.loopingSong.replace("%TITLE%", serverQueue.songs[0].title);
msg.channel.send(message);
} else { } else {
serverQueue.songLooping = false; serverQueue.songLooping = false;
msg.channel.send(client.messages.noLoopingSong); msg.channel.send(message);
} }
} }
} }

View File

@ -10,7 +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 || !serverQueue.playing) return msg.channel.send(client.messages.noServerQueue); if (!serverQueue) return msg.channel.send(client.messages.noServerQueue);
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;

View File

@ -9,33 +9,23 @@ module.exports = {
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(client.messages.noServerQueue); if (!serverQueue) return msg.channel.send(client.messages.noServerQueue);
if (args[1]) { const page = 1;
if (isNaN(args[1])) return msg.channel.send(client.messages.validNumber);
}
let page = parseInt(args[1]);
if (!page) page = 1;
let pagetext = client.messages.queuePages;
if (page === 1) pagetext = client.messages.queueFirstPage;
let queuesongs = serverQueue.songs.slice((page - 1) * 20 + 1, page * 20 + 1); let queuesongs = serverQueue.songs.slice((page - 1) * 20 + 1, page * 20 + 1);
let queuemessage = `${queuesongs.map(song => `**#** ${song.title}`).join('\n')}` let queuemessage = `${queuesongs.map(song => `**#** ${song.title}`).join('\n')}`
const hashs = queuemessage.split('**#**').length; const hashs = queuemessage.split('**#**').length;
for (let i = 0; i < hashs; i++) { for (let i = 0; i < hashs; i++) {
queuemessage = queuemessage.replace('**#**', `**${i + 1}**`); queuemessage = queuemessage.replace('**#**', `**${i + 1}**`);
} }
client.messages.queueDesc = client.messages.queueDesc.replace("%SONG%", song.title); let message;
if (!serverQueue.looping) { message = client.messages.queueDesc.replace("%SONG%", serverQueue.songs[0].title);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(client.messages.queueTitle) .setTitle(client.messages.queueTitle)
.setDescription(`${client.messages.queueDesc}\n${pagetext}\n${queuemessage}`) .setDescription(`${message}\n${queuemessage}`)
.setColor(client.config.embedColor) .setFooter(`${serverQueue.songs.size - 20} ${client.messages.queueFooter}`)
return msg.channel.send(embed); .setColor(client.config.embedColor)
} else { /*if (serverQueue.songs.size > 20) {
const embed = new Discord.MessageEmbed() embed.setFooter(`${serverQueue.songs.size - 20} ${client.messages.queueFooter}`)
.setTitle(client.messages.queueTitle) }*/
.setDescription(`${client.messages.queueDesc}\n${pagetext}\n${queuemessage}`) return msg.channel.send(embed);
.setFooter('<:repeat1:674685561377914892> Currently looping the queue!')
.setColor(client.config.embedColor)
return msg.channel.send(embed);
}
} }
}; };

View File

@ -13,10 +13,12 @@ module.exports = {
const pos = parseInt(args[1]); const pos = parseInt(args[1]);
if (isNaN(pos)) return msg.channel.send(client.messages.validNumber); if (isNaN(pos)) return msg.channel.send(client.messages.validNumber);
if (pos < 1) return msg.channel.send(client.messages.noSongs); if (pos < 1) return msg.channel.send(client.messages.noSongs);
client.messages.queueLength = client.messages.queueLength.replace("%LENGTH%", serverQueue.songs.length); let message1;
if (pos > serverQueue.songs.length) return msg.channel.send(client.messages.queueLength); let message2;
client.messages.removed = client.messages.removed.replace("%SONG%", serverQueue.songs[pos].title); message1 = client.messages.queueLength.replace("%LENGTH%", serverQueue.songs.length);
msg.channel.send(client.messages.removed); if (pos > serverQueue.songs.length) return msg.channel.send(message1);
message2 = client.messages.removed.replace("%SONG%", serverQueue.songs[pos].title);
msg.channel.send(message2);
return serverQueue.songs.splice(pos, 1); return serverQueue.songs.splice(pos, 1);
} }
} }

View File

@ -36,8 +36,9 @@ module.exports = {
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);
} }
client.messages.playlistAdded = client.messages.playlistAdded.replace("%TITLE%", playlist.title); let message;
return lmsg.edit(client.messages.playlistAdded); message = client.messages.playlistAdded.replace("%TITLE%", playlist.title);
return lmsg.edit(message);
} else { } else {
try { try {
var video = await youtube.getVideo(url); var video = await youtube.getVideo(url);

View File

@ -16,8 +16,9 @@ module.exports = {
const pos = parseInt(args[1]); const pos = parseInt(args[1]);
if (isNaN(pos)) { if (isNaN(pos)) {
if (pos < 0) return msg.channel.send(client.messages.seekingPointPositive); if (pos < 0) return msg.channel.send(client.messages.seekingPointPositive);
client.messages.seekMax = client.messages.seekMax.replace("%LENGTH%", data.length_seconds); let message;
if (pos > data.length_seconds) return msg.channel.send(client.messages.seekMax); message = client.messages.seekMax.replace("%LENGTH%", data.length_seconds);
if (pos > data.length_seconds) return msg.channel.send(message);
point = pos; point = pos;
} }
serverQueue.connection.dispatcher.end(); serverQueue.connection.dispatcher.end();

View File

@ -17,7 +17,7 @@ module.exports = {
.addField(client.messages.settingsBass, client.messages.settingsBassDesc, true) .addField(client.messages.settingsBass, client.messages.settingsBassDesc, true)
.setFooter(client.messages.settingsFooter) .setFooter(client.messages.settingsFooter)
.setAuthor(client.user.username, client.user.displayAvatarURL) .setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor(client.embedColor) .setColor(client.config.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(client.messages.noPermsManageSettings); if (!permissions.has(command.permission)) return msg.channel.send(client.messages.noPermsManageSettings);

View File

@ -22,7 +22,7 @@ module.exports = {
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(client.messages.notAllowed); 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); //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);
} }
} }

View File

@ -1,6 +1,6 @@
/* /*
THIS FILE CONTAINS ALL MESSAGES THAT MUSIX SENDS! THIS FILE CONTAINS ALL MESSAGES THAT MUSIX SENDS!
THIS IS MUSIX BRANDING AND YOU'RE NOT PERMITTED TO COPY ALL THE VISUALS FROM MUSIX! THIS IS MUSIX BRANDING AND YOU'RE NOT PERMITTED TO COPY THE VISUALS OF MUSIX!
IF YOU CLONED THIS REPOSITORY PLEASE MODIFY THESE MESSAGES! IF YOU CLONED THIS REPOSITORY PLEASE MODIFY THESE MESSAGES!
*/ */
module.exports = { module.exports = {
@ -14,18 +14,18 @@ module.exports = {
boolean: "<:redx:674263474704220182> Please define a boolean! (true/false)", boolean: "<:redx:674263474704220182> Please define a boolean! (true/false)",
bugDesc: "Matte#0002\nOr join the support server: https://discord.gg/rvHuJtB", bugDesc: "Matte#0002\nOr join the support server: https://discord.gg/rvHuJtB",
bugTitle: "Found a bug with Musix?\nDM the core developer:", bugTitle: "Found a bug with Musix?\nDM the core developer:",
cancellingVideoSelection: "'<:redx:674263474704220182> Cancelling video selection", cancellingVideoSelection: "<:redx:674263474704220182> Cancelling video selection",
cantSkipToCurrent: "<:redx:674263474704220182> You can\'t skip to the song currently playing!", cantSkipToCurrent: "<:redx:674263474704220182> You can't skip to the song currently playing!",
cmdUsesFooter: "These statistics are from the current uptime.", cmdUsesFooter: "These statistics are from the current uptime.",
cmdUsesTitle: "Musix Command Usage During Current Uptime", cmdUsesTitle: "Musix Command Usage During Current Uptime",
correctUsage: "<:redx:674263474704220182> correct usage: ", correctUsage: "<:redx:674263474704220182> correct usage: ",
currentBass: ":loud_sound: The current bass is: ", currentBass: ":loud_sound: The current bass is: ",
currentDefaultBass: ":speaker: Currect default bass level:", currentDefaultBass: ":speaker: Currect default bass level: ",
currentDefaultVolume: ":speaker: Current default volume is:", currentDefaultVolume: ":speaker: Current default volume is:",
currentPrefix: "Current prefix:", currentPrefix: "Current prefix:",
currentVolume: ":loud_sound: The current volume is: ", currentVolume: ":loud_sound: The current volume is: ",
defaultVolumeMax: "<:redx:674263474704220182> The default volume must be below `100` for quality and safety resons.", defaultVolumeMax: "<:redx:674263474704220182> The default volume must be below `100` for quality and safety resons.",
defaultVolumeNumber: "<:redx:674263474704220182> I\'m sorry, But the default volume needs to be a valid __number__.", defaultVolumeNumber: "<:redx:674263474704220182> I'm sorry, But the default volume needs to be a valid __number__.",
defaultVolumeSet: "<:green_check_mark:674265384777416705> Default volume set to:", defaultVolumeSet: "<:green_check_mark:674265384777416705> Default volume set to:",
devMode: "<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!", devMode: "<:redx:674263474704220182> Dev mode has been turned on! Commands are only available to developer(s)!",
dispatcherError: "Error with the dispatcher: ", dispatcherError: "Error with the dispatcher: ",
@ -36,8 +36,8 @@ module.exports = {
errorConnecting: "Error with connecting to voice channel: ", errorConnecting: "Error with connecting to voice channel: ",
errorDetected: "Error detected: ", errorDetected: "Error detected: ",
errorDispatcher: "<:redx:674263474704220182> An error has occured while playing music! The queue has been deleted.", errorDispatcher: "<:redx:674263474704220182> An error has occured while playing music! The queue has been deleted.",
errorExe: "<:redx:674263474704220182> there was an error trying to execute that command! Please contact support with the \`bug\` command!", 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!", errorExeOpt: "<:redx:674263474704220182> there was an error trying to execute that option! Please contact support with the `bug` command!",
evalTitle: "Evaluation Command", evalTitle: "Evaluation Command",
helpCmdFooter: "Command Alias:", helpCmdFooter: "Command Alias:",
helpFooter: "\"%PREFIX%help <command>\" to see more information about a command.", helpFooter: "\"%PREFIX%help <command>\" to see more information about a command.",
@ -67,13 +67,13 @@ module.exports = {
notAllowed: "<:redx:674263474704220182> You are not allowed to do that!", notAllowed: "<:redx:674263474704220182> You are not allowed to do that!",
notEnoughVotes: "<:redx:674263474704220182> Not enough votes!", notEnoughVotes: "<:redx:674263474704220182> Not enough votes!",
notPaused: "<:redx:674263474704220182> The music in not paused!", notPaused: "<:redx:674263474704220182> The music in not paused!",
noVoiceChannel: "<:redx:674263474704220182> I\'m sorry but you need to be in a voice channel to play music!", noVoiceChannel: "<:redx:674263474704220182> I'm sorry but you need to be in a voice channel to play music!",
nowPlaying: "__Now playing__", nowPlaying: "__Now playing__",
paused: "<:pause:674685548610322462> Paused the music!", paused: "<:pause:674685548610322462> Paused the music!",
permission: "🔒 Permission requirement:", permission: "🔒 Permission requirement:",
permissionsFalse: "<:redx:674263474704220182> That value is already `false`!", permissionsFalse: "<:redx:674263474704220182> That value is already `false`!",
permissionsSetFalse: "<:green_check_mark:674265384777416705> Permissions requirement now set to: \`false\`", permissionsSetFalse: "<:green_check_mark:674265384777416705> Permissions requirement now set to: `false`",
permissionsSetTrue: "<:green_check_mark:674265384777416705> Permissions requirement now set to: \`true\`", permissionsSetTrue: "<:green_check_mark:674265384777416705> Permissions requirement now set to: `true`",
permissionsTrue: "<:redx:674263474704220182> That value is already `true`!", permissionsTrue: "<:redx:674263474704220182> That value is already `true`!",
pinging: "<a:loading:674284196700618783> Pinging...", pinging: "<a:loading:674284196700618783> Pinging...",
playlistAdded: "<:green_check_mark:674265384777416705> Playlist: **%TITLE%** has been added to the queue!", playlistAdded: "<:green_check_mark:674265384777416705> Playlist: **%TITLE%** has been added to the queue!",
@ -84,13 +84,12 @@ module.exports = {
provideANumber: "Please provide a number ranging from 1-10 to select one of the search results.", provideANumber: "Please provide a number ranging from 1-10 to select one of the search results.",
provideASong: "<:redx:674263474704220182> Please provide a song position in queue for me to remove!", provideASong: "<:redx:674263474704220182> Please provide a song position in queue for me to remove!",
queueDeleted: "Queue deleted!", queueDeleted: "Queue deleted!",
queueDesc: "**Now playing:** %SONG%<a:aNotes:674602408105476106>", queueDesc: "**Now playing:** %SONG%<a:aNotes:674602408105476106>\n:arrow_down: Next in queue :arrow_down:",
queueFirstPage: ":page_facing_up: Page: ${page} :page_facing_up:", queueFooter: "More songs in the queue!",
queueLength: "<:redx:674263474704220182> There are only %SONGS% amount of songs in the queue!", queueLength: "<:redx:674263474704220182> There are only %SONGS% amount of songs in the queue!",
queuePages: ":arrow_down: Next in queue :arrow_down:",
queueTitle: "__Song queue__", queueTitle: "__Song queue__",
reloaded: "All files reloaded!", reloaded: "All files reloaded!",
removed: "🗑 removed \`%SONG%\` from the queue!", removed: "🗑 removed `%SONG%` from the queue!",
reset: "<:green_check_mark:674265384777416705> Reset __all__ guild settings!", reset: "<:green_check_mark:674265384777416705> Reset __all__ guild settings!",
restart: "restarted!", restart: "restarted!",
resumed: "<:resume:674685585478254603> Resumed the music!", resumed: "<:resume:674685585478254603> Resumed the music!",
@ -121,6 +120,6 @@ module.exports = {
statusField3: ":stopwatch: Uptime", statusField3: ":stopwatch: Uptime",
statusTitle: "Status for Musix", statusTitle: "Status for Musix",
stop: "<:stop:674685626108477519> Stopped the music!", stop: "<:stop:674685626108477519> Stopped the music!",
validNumber: "<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.", validNumber: "<:redx:674263474704220182> I'm sorry, But you need to enter a valid __number__.",
wrongVoiceChannel: "<:redx:674263474704220182> I'm sorry but you need to be in the same voice channel as Musix to use this command!", wrongVoiceChannel: "<:redx:674263474704220182> I'm sorry but you need to be in the same voice channel as Musix to use this command!",
}; };

View File

@ -1,9 +1,15 @@
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(client.messages.noServerQueue); if (!serverQueue || !serverQueue.playing) {
msg.channel.send(client.messages.noServerQueue);
return false;
}
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(client.messages.wrongVoiceChannel); if (msg.member.voice.channel !== serverQueue.voiceChannel) {
msg.channel.send(client.messages.wrongVoiceChannel);
return false;
}
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)) {
@ -11,8 +17,9 @@ module.exports = function (client, msg, command) {
return false; return false;
} else return true; } else return true;
} else if (!permissions.has(command.permission)) { } else if (!permissions.has(command.permission)) {
client.messages.noPerms = client.messages.noPerms.replace("%PERMS%", commands.permissions); let message
msg.channel.send(client.messages.noPerms); message = client.messages.noPerms.replace("%PERMS%", commands.permissions);
msg.channel.send(message);
return false; return false;
} else return true; } else return true;
} else return true; } else return true;

View File

@ -12,8 +12,9 @@ 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;
client.messages.songsAdded = client.messages.songAdded.replace("%TITLE%", song.title); let message;
return msg.channel.send(client.messages.songAdded); message = client.messages.songAdded.replace("%TITLE%", song.title);
return msg.channel.send(message);
} }
const construct = require("../config/queueConfig.js"); const construct = require("../config/queueConfig.js");

View File

@ -7,8 +7,9 @@ module.exports = async function (client, msg, youtube, voiceChannel, url) {
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);
} }
client.messages.playlistAdded = client.messages.playlistAdded.replace("%TITLE%", playlist.title); let message;
lmsg.edit(client.messages.playlistAdded); message = client.messages.playlistAdded.replace("%TITLE%", playlist.title);
lmsg.edit(message);
return true; return true;
} else { } else {
return false; return false;