mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-31 07:24:33 +00:00
Updated everything
This commit is contained in:
@@ -12,7 +12,6 @@ module.exports = {
|
||||
output = await eval(input);
|
||||
} catch (error) {
|
||||
output = error.toString();
|
||||
embed.setColor('#FF0000');
|
||||
}
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('Evaluation Command')
|
||||
|
@@ -6,15 +6,16 @@ module.exports = {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('Commands for Musix!')
|
||||
.addField(`${prefix}play | ${prefix}p`, 'Play a song.', true)
|
||||
.addField(`${prefix}skip | ${prefix}s`, 'Skip a song.', true)
|
||||
.addField(`${prefix}queue | ${prefix}q`, 'Display the queue.', true)
|
||||
.addField(`${prefix}nowplaying | ${prefix}np`, 'Display whats currently playing.', true)
|
||||
.addField(`${prefix}volume`, 'Change or check the volume.', true)
|
||||
.addField(`${prefix}pause`, 'Pause the music.', true)
|
||||
.addField(`${prefix}resume`, 'Resume the music.', true)
|
||||
.addField(`${prefix}stop`, 'Stop the music, Clear the queue and leave the current voice channel.', true)
|
||||
.addField(`${prefix}skip | ${prefix}s`, 'Skip a song.', true)
|
||||
.addField(`${prefix}restartmusic`, 'Restart the music. Recommended to use instead of stop on any possible errors.', true)
|
||||
.addField(`${prefix}invite`, 'Invite Musix.', true)
|
||||
.addField(`${prefix}ping`, 'See the current ping for Musix', true)
|
||||
.addField(`${prefix}status`, 'See different information for Musix.', true)
|
||||
.addField(`${prefix}bug`, 'Report a bug.', true)
|
||||
.addField(`${prefix}settings`, 'Change the guild specific settings.', true)
|
||||
.addField(`${prefix}help`, 'Display the help.', true)
|
||||
|
@@ -1,24 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'np',
|
||||
description: 'Now playing command.',
|
||||
cooldown: 5,
|
||||
async execute(message, args, client, RichEmbed) {
|
||||
const ytdl = require('ytdl-core')
|
||||
const serverQueue = client.queue.get(message.guild.id);
|
||||
if (!serverQueue) return message.channel.send(':x: There is nothing playing.');
|
||||
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
||||
let songtime = (data.length_seconds * 1000).toFixed(0);
|
||||
let completed = (serverQueue.connection.dispatcher.time).toFixed(0);
|
||||
let barlength = 30;
|
||||
let completedpercent = ((completed / songtime) * barlength).toFixed(0);
|
||||
let array = []; for (let i = 0; i < completedpercent - 1; i++) { array.push('⎯'); } array.push('⭗'); for (let i = 0; i < barlength - completedpercent - 1; i++) { array.push('⎯'); }
|
||||
const totallength = Math.floor(data.length_seconds / 60) + ':' + (data.length_seconds - (Math.floor(data.length_seconds / 60) * 60))
|
||||
const timeins = serverQueue.connection.dispatcher.time / 1000
|
||||
const timepassed = Math.floor(timeins / 60) + ':' + Math.round(timeins - (Math.floor(timeins / 60) * 60))
|
||||
const embed = new RichEmbed()
|
||||
.setTitle("__Now playing__")
|
||||
.setDescription(`🎶**Now playing:** ${serverQueue.songs[0].title}\n${array.join('')} | \`${timepassed} / ${totallength}\``)
|
||||
.setColor("#b50002")
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
};
|
@@ -1,65 +0,0 @@
|
||||
const YouTube = require("simple-youtube-api");
|
||||
|
||||
module.exports = {
|
||||
name: 'p',
|
||||
description: 'Play command.',
|
||||
usage: '[song name]',
|
||||
args: true,
|
||||
cooldown: 3,
|
||||
async execute(message, args, client, RichEmbed) {
|
||||
const youtube = new YouTube(client.config.apikey);
|
||||
const searchString = args.slice(1).join(" ");
|
||||
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const serverQueue = client.queue.get(message.guild.id);
|
||||
const voiceChannel = message.member.voiceChannel;
|
||||
if (!voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in a voice channel to play music!');
|
||||
if (!args[1]) return message.channel.send(':x: You need to use a link or search for a song!');
|
||||
const permissions = voiceChannel.permissionsFor(message.client.user);
|
||||
if (!permissions.has('CONNECT')) {
|
||||
return message.channel.send(':x: I cannot connect to your voice channel, make sure I have the proper permissions!');
|
||||
}
|
||||
if (!permissions.has('SPEAK')) {
|
||||
return message.channel.send(':x: I cannot speak in this voice channel, make sure I have the proper permissions!');
|
||||
}
|
||||
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
|
||||
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.handleVideo(video2, message, voiceChannel, true);
|
||||
}
|
||||
return message.channel.send(`:white_check_mark: Playlist: **${playlist.title}** has been added to the queue!`);
|
||||
} else {
|
||||
try {
|
||||
var video = await youtube.getVideo(url);
|
||||
} catch (error) {
|
||||
try {
|
||||
var videos = await youtube.searchVideos(searchString, 10);
|
||||
let index = 0;
|
||||
const embed = new RichEmbed()
|
||||
.setTitle("__Song Selection__")
|
||||
.setDescription(`${videos.map(video2 => `**${++index}** \`${video2.title}\` `).join('\n')}`)
|
||||
.setFooter("Please provide a number ranging from 1-10 to select one of the search results.")
|
||||
.setColor("#b50002")
|
||||
message.channel.send(embed);
|
||||
try {
|
||||
var response = await message.channel.awaitMessages(message2 => message2.content > 0 && message2.content < 11, {
|
||||
maxMatches: 1,
|
||||
time: 10000,
|
||||
errors: ['time']
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return Message.channel.send(':x: Cancelling video selection.');
|
||||
}
|
||||
const videoIndex = parseInt(response.first().content);
|
||||
var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return message.channel.send(':x: I could not obtain any search results.');
|
||||
}
|
||||
}
|
||||
return client.handleVideo(video, message, voiceChannel);
|
||||
}
|
||||
}
|
||||
};
|
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'ping',
|
||||
description: 'Ping command.',
|
||||
cooldown: 5,
|
||||
execute(message, args, client, RichEmbed) {
|
||||
return message.channel.send(`My current Ping: **${Math.floor(client.ping * 10) / 10} ms**.`);
|
||||
}
|
||||
};
|
@@ -38,7 +38,7 @@ module.exports = {
|
||||
let index = 0;
|
||||
const embed = new RichEmbed()
|
||||
.setTitle("__Song Selection__")
|
||||
.setDescription(`${videos.map(video2 => `**${++index}** \`${video2.title}\` `).join('\n')}`)
|
||||
.setDescription(`${videos.map(video2 => `**${++index}** ${video2.title} `).join('\n')}`)
|
||||
.setFooter("Please provide a number ranging from 1-10 to select one of the search results.")
|
||||
.setColor("#b50002")
|
||||
message.channel.send(embed);
|
||||
@@ -59,7 +59,7 @@ module.exports = {
|
||||
return message.channel.send(':x: I could not obtain any search results.');
|
||||
}
|
||||
}
|
||||
return client.handleVideo(video, message, voiceChannel);
|
||||
return client.funcs.handleVideo(video, message, voiceChannel, client);
|
||||
}
|
||||
}
|
||||
};
|
@@ -1,28 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'q',
|
||||
description: 'Queue command.',
|
||||
cooldown: 5,
|
||||
async execute(message, args, client, RichEmbed) {
|
||||
const serverQueue = client.queue.get(message.guild.id);
|
||||
if (!serverQueue) return message.channel.send(':x: There is nothing playing.');
|
||||
if (args[1]) {
|
||||
if (isNaN(args[1])) return msg.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.');
|
||||
}
|
||||
let page = parseInt(args[1]);
|
||||
if (!page) page = 1;
|
||||
let pagetext = `:page_facing_up: Page: ${page} :page_facing_up:`
|
||||
if (page === 1) pagetext = ':arrow_down: Next in queue :arrow_down:'
|
||||
let queuesongs = serverQueue.songs.slice((page - 1) * 20 + 1, page * 20 + 1);
|
||||
let queuemessage = `${queuesongs.map(song => `**#** ${song.title}`).join('\n')}`
|
||||
const hashs = queuemessage.split('**#**').length;
|
||||
for (let i = 0; i < hashs; i++) {
|
||||
queuemessage = queuemessage.replace('**#**', `**${i + 1}**`);
|
||||
|
||||
}
|
||||
const embed = new RichEmbed()
|
||||
.setTitle("__Song queue__")
|
||||
.setDescription(`**Now playing:** ${serverQueue.songs[0].title}🎶\n${pagetext}\n${queuemessage}`)
|
||||
.setColor("#b50002")
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
};
|
@@ -1,17 +0,0 @@
|
||||
module.exports = {
|
||||
name: 's',
|
||||
description: 'Skip command.',
|
||||
cooldown: 5,
|
||||
execute(message, args, client, RichEmbed) {
|
||||
const { voiceChannel } = message.member;
|
||||
const serverQueue = client.queue.get(message.guild.id);
|
||||
const permissions = message.channel.permissionsFor(message.author);
|
||||
if (!serverQueue) return message.channel.send(':x: There is nothing playing that I could skip for you.');
|
||||
if (message.author.id !== '360363051792203779') {
|
||||
if (!voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in a voice channel to skip songs!');
|
||||
if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to skip songs!');
|
||||
}
|
||||
message.channel.send(':fast_forward: Skipped the song for you!');
|
||||
serverQueue.connection.dispatcher.end('Skip command has been used!');
|
||||
}
|
||||
};
|
@@ -2,13 +2,18 @@ module.exports = {
|
||||
name: 'settings',
|
||||
usage: '[setting]',
|
||||
description: 'Change the settings',
|
||||
cooldown: 5,
|
||||
cooldown: 10,
|
||||
async execute(message, args, client, RichEmbed, prefix) {
|
||||
const permissions = message.channel.permissionsFor(message.author);
|
||||
if (message.author.id !== '360363051792203779') {
|
||||
if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to change the settings!');
|
||||
}
|
||||
if (!args[1]) {
|
||||
if (args[1] === 'prefix') {
|
||||
if (!args[2]) return message.channel.send(':x: You need to define the prefix!');
|
||||
if (args[2].length > 5) return message.channel.send(':x: The prefix must be less than or equal to 5 characters');
|
||||
await client.setPrefix(args[2], message.guild.id);
|
||||
message.channel.send(`:white_check_mark: New prefix set to: \`${args[2]}\`\n`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('Guild settings for Musix')
|
||||
.addField('prefix', 'Change the guild specific prefix.', true)
|
||||
@@ -17,11 +22,5 @@ module.exports = {
|
||||
.setColor('#b50002')
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
if (args[1] === 'prefix') {
|
||||
if (!args[2]) return message.channel.send(':x: You need to define the prefix!');
|
||||
if (args[2].length > 5) return message.channel.send(':x: The prefix must be less than or equal to 5 characters');
|
||||
await client.setPrefix(args[2], message.guild.id);
|
||||
message.channel.send(`:white_check_mark: New prefix set: \`${args[2]}\`\n${client.global.replies.fiveMinutes}`);
|
||||
}
|
||||
},
|
||||
};
|
37
commands/status.js
Normal file
37
commands/status.js
Normal file
@@ -0,0 +1,37 @@
|
||||
module.exports = {
|
||||
name: 'status',
|
||||
description: 'Status command.',
|
||||
cooldown: 5,
|
||||
execute(message, args, client, RichEmbed) {
|
||||
let rawUptime = client.uptime;
|
||||
let uptime = {};
|
||||
uptime['d'] = rawUptime / 86400000;
|
||||
uptime['h'] = rawUptime / 3600000;
|
||||
uptime['m'] = rawUptime / 60000;
|
||||
let finalUptime;
|
||||
if (uptime.d < 1) {
|
||||
finalUptime = `${Math.round(uptime.h * 10) / 10} hours`;
|
||||
} else {
|
||||
finalUptime = `${Math.round(uptime.d * 10) / 10} days`;
|
||||
}
|
||||
let onlinehost = process.env.hosted;
|
||||
let hosted = process.env.hosted;
|
||||
if (onlinehost !== undefined) {
|
||||
hosted = 'Online';
|
||||
} else {
|
||||
hosted = 'Locally';
|
||||
}
|
||||
let ping = Math.floor(client.ping * 10) / 10;
|
||||
|
||||
const embed = new RichEmbed()
|
||||
.setTitle(`Status for ${client.user.username}`)
|
||||
.addField(':signal_strength: Ping', ping, true)
|
||||
.addField(':stopwatch: Uptime', finalUptime, true)
|
||||
.addField(`:play_pause: Currently playing music on ${client.voiceConnections.size} guilds.`, `Of ${client.guilds.size} Guilds.`, true)
|
||||
.addField(':satellite: Currently hosted', hosted, true)
|
||||
.addField(`💿 Operating system`, process.platform, true)
|
||||
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
||||
.setColor('#b50002')
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user