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

Update V3.0.4

This commit is contained in:
MatteZ02 2020-03-21 19:49:25 +02:00
parent b9f0eb3a96
commit 7e20f54362
63 changed files with 124 additions and 90 deletions

View File

@ -1,16 +0,0 @@
module.exports = {
name: 'bug',
alias: 'none',
usage: '',
description: 'Report a bug',
onlyDev: false,
permission: 'none',
category: 'info',
async execute(msg, args, client, Discord, prefix, command) {
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.bugTitle)
.setDescription(client.messages.bugDesc)
.setColor(client.config.embedColor);
msg.channel.send(embed);
},
};

View File

@ -1,12 +0,0 @@
module.exports = {
name: 'announcesongs',
async execute(msg, args, client, Discord, prefix) {
if (client.global.db.guilds[msg.guild.id].startPlaying) {
client.global.db.guilds[msg.guild.id].startPlaying = false;
return msg.channel.send(client.messages.announceSongsFalse);
} else {
client.global.db.guilds[msg.guild.id].startPlaying = true;
return msg.channel.send(client.messages.announceSongsTrue);
}
}
};

View File

@ -1,4 +1,4 @@
const config = require("./struct/config/config.js"); const config = require("./src/struct/config/config.js");
if (config.devMode) { if (config.devMode) {
config.token = config.devToken; config.token = config.devToken;
@ -6,7 +6,7 @@ if (config.devMode) {
} }
const { ShardingManager } = require('discord.js'); const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./bot.js', { token: config.token, respawn: true, totalShards: config.shards }); const manager = new ShardingManager('./src/bot.js', { token: config.token, respawn: config.respawn, totalShards: config.shards });
console.log('Launching shards...'); console.log('Launching shards...');
manager.spawn(config.shards, config.shardDelay, config.shardTimeout); manager.spawn(config.shards, config.shardDelay, config.shardTimeout);

View File

@ -1,6 +1,6 @@
{ {
"name": "musix", "name": "musix",
"version": "3.0.3", "version": "3.0.4",
"description": "V3 for Musix the discord music bot", "description": "V3 for Musix the discord music bot",
"main": "./index.js", "main": "./index.js",
"scripts": { "scripts": {

View File

View File

@ -4,10 +4,10 @@ module.exports = {
alias: 'none', alias: 'none',
usage: '<bass>', usage: '<bass>',
cooldown: 5, cooldown: 5,
onlyDev: true, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue) return msg.channel.send(`${client.messages.currentBass}**${queue.bass}**`); if (!args[1] && queue) return msg.channel.send(`${client.messages.currentBass}**${queue.bass}**`);
const bass = parseFloat(args[1]); const bass = parseFloat(args[1]);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'dev', permission: 'dev',
category: 'info', category: 'info',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const cmduses = []; const cmduses = [];
client.commands.forEach((value, key) => { client.commands.forEach((value, key) => {
cmduses.push([key, value.uses]); cmduses.push([key, value.uses]);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'dev', permission: 'dev',
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
client.queue.delete(msg.guild.id); client.queue.delete(msg.guild.id);
msg.channel.send(client.messages.queueDeleted); msg.channel.send(client.messages.queueDeleted);
} }

View File

@ -6,14 +6,14 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'dev', permission: 'dev',
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
let data; let data;
if (queue) { if (queue) {
data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url)); data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
} }
const input = msg.content.slice(prefix.length + 4); const input = msg.content.slice(client.global.db.guilds[msg.guild.id].prefix.length + 5);
let output; let output;
try { try {
output = await eval(input); output = await eval(input);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
if (args[1]) { if (args[1]) {
if (!client.commands.has(args[1]) || (client.commands.has(args[1]) && client.commands.get(args[1]).omitFromHelp === true && msg.guild.id !== '489083836240494593')) return msg.channel.send('That command does not exist'); if (!client.commands.has(args[1]) || (client.commands.has(args[1]) && client.commands.get(args[1]).omitFromHelp === true && msg.guild.id !== '489083836240494593')) return msg.channel.send('That command does not exist');
const command = client.commands.get(args[1]); const command = client.commands.get(args[1]);
@ -26,7 +26,7 @@ module.exports = {
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`;
} }
let message; let message;
message = client.messages.helpFooter.replace("%PREFIX%", prefix); message = client.messages.helpFooter.replace("%PREFIX%", client.global.db.guilds[msg.guild.id].prefix);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(`${client.user.username} ${client.messages.helpTitle}`) .setTitle(`${client.user.username} ${client.messages.helpTitle}`)
.setDescription(commands) .setDescription(commands)

View File

@ -6,11 +6,12 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(client.messages.inviteTitle) .setTitle(client.messages.inviteTitle)
.setURL(client.config.invite) .setURL(client.config.invite)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
return msg.channel.send(embed); msg.channel.send(embed);
msg.channel.send(client.messages.joinSupport + client.config.supportServer);
} }
}; };

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'none', permission: 'none',
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
try { try {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel; const voiceChannel = msg.member.voice.channel;

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (!queue.looping) { if (!queue.looping) {

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (!queue.songLooping) { if (!queue.songLooping) {

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const getThumb = require('video-thumbnail-url'); const getThumb = require('video-thumbnail-url');
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (queue.paused) return msg.channel.send(client.messages.alreadyPaused); if (queue.paused) return msg.channel.send(client.messages.alreadyPaused);

View File

@ -8,7 +8,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const youtube = new YouTube(client.config.api_key); const youtube = new YouTube(client.config.api_key);
const searchString = args.slice(1).join(" "); const searchString = args.slice(1).join(" ");
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : ""; const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!queue) return msg.channel.send(client.messages.noServerQueue); if (!queue) return msg.channel.send(client.messages.noServerQueue);
const page = 1; const page = 1;

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = 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(client.messages.provideASong); if (!args[1]) return msg.channel.send(client.messages.provideASong);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'dev', permission: 'dev',
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
client.shard.respawnAll(client.config.shardDelay, client.config.respawnDelay, client.config.spawnTimeout); client.shard.respawnAll(client.config.shardDelay, client.config.respawnDelay, client.config.spawnTimeout);
} }
}; };

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
if (!queue.paused) return msg.channel.send(client.messages.notPaused); if (!queue.paused) return msg.channel.send(client.messages.notPaused);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'dev', permission: 'dev',
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
client.funcs.saveDB(client); client.funcs.saveDB(client);
msg.channel.send(client.messages.dbSaved); msg.channel.send(client.messages.dbSaved);
} }

View File

@ -9,7 +9,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const youtube = new YouTube(client.config.api_key); const youtube = new YouTube(client.config.api_key);
const searchString = args.slice(1).join(" "); const searchString = args.slice(1).join(" ");
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : ""; const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";

View File

@ -6,12 +6,12 @@ module.exports = {
onlyDev: true, onlyDev: true,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const queue = client.queue.get(msg.guild.id); const queue = 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(queue.songs[0].url)); let data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${prefix}seek ${command.usage}\``); if (!args[1]) return msg.channel.send(`${client.messages.correctUsage}\`${client.global.db.guilds[msg.guild.id].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)) {

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_GUILD', permission: 'MANAGE_GUILD',
category: 'util', category: 'util',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(client.messages.settingsTitle) .setTitle(client.messages.settingsTitle)
.addField(client.messages.settingsPrefix, client.messages.settingsPrefixDesc, true) .addField(client.messages.settingsPrefix, client.messages.settingsPrefixDesc, true)
@ -27,7 +27,7 @@ module.exports = {
const option = client.settingCmd.get(optionName) || client.settingCmd.find(cmd => cmd.aliases && cmd.aliases.includes(optionName)); const option = client.settingCmd.get(optionName) || client.settingCmd.find(cmd => cmd.aliases && cmd.aliases.includes(optionName));
if (!option) return msg.channel.send(embed); if (!option) return msg.channel.send(embed);
try { try {
option.execute(msg, args, client, Discord, prefix); option.execute(msg, args, client);
} catch (error) { } catch (error) {
msg.reply(client.messages.errorExeOpt); msg.reply(client.messages.errorExeOpt);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()

View File

@ -0,0 +1,17 @@
module.exports = {
name: 'announcesongs',
async execute(msg, args, client) {
if (!args[2]) return msg.channel.send(`${client.messages.announceSongs} \`${client.global.db.guilds[msg.guild.id].permissions}\``);
if (args[2] === 'true') {
if (!client.global.db.guilds[msg.guild.id].announceSongs) {
client.global.db.guilds[msg.guild.id].announceSongs = true;
msg.channel.send(client.messages.permissionsSetTrue);
} else return msg.channel.send(client.messages.announceSongsTrue);
} else if (args[2] === 'false') {
if (client.global.db.guilds[msg.guild.id].announceSongs) {
client.global.db.guilds[msg.guild.id].announceSongs = false;
msg.channel.send(client.messages.announceSongsFalse);
} else return msg.channel.send(client.messages.announceSongsFalse);
} else return msg.channel.send(client.messages.boolean);
}
};

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
name: 'bass', name: 'bass',
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client) {
if (!args[2]) return msg.channel.send(client.messages.currentDefaultBass + 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;

View File

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

View File

@ -1,7 +1,8 @@
module.exports = { module.exports = {
name: 'prefix', name: 'prefix',
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client) {
if (!args[2]) return msg.channel.send(`${client.messages.currentPrefix} \`${client.global.db.guilds[msg.guild.id].prefix}\``); if (!args[2]) return msg.channel.send(`${client.messages.currentPrefix} \`${client.global.db.guilds[msg.guild.id].prefix}\``);
if (args[2].length > 5) return msg.channel.send(client.messages.prefixMaxLength);
client.global.db.guilds[msg.guild.id].prefix = args[2]; client.global.db.guilds[msg.guild.id].prefix = args[2];
msg.channel.send(`${client.messages.prefixSet} \`${args[2]}\``); msg.channel.send(`${client.messages.prefixSet} \`${args[2]}\``);
} }

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
name: 'reset', name: 'reset',
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client) {
client.global.db.guilds[msg.guild.id] = { client.global.db.guilds[msg.guild.id] = {
prefix: client.config.prefix, prefix: client.config.prefix,
defaultVolume: 5, defaultVolume: 5,

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
name: 'setdj', name: 'setdj',
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client) {
if (!client.global.db.guilds[msg.guild.id].dj) { if (!client.global.db.guilds[msg.guild.id].dj) {
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;

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
name: 'volume', name: 'volume',
async execute(msg, args, client, Discord, prefix) { async execute(msg, args, client) {
if (!args[2]) return msg.channel.send(`${client.messages.currentDefaultVolume} \`${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(client.messages.defaultVolumeNumber); if (isNaN(args[2])) return msg.channel.send(client.messages.defaultVolumeNumber);
if (args[2].length > 2) return msg.channel.send(client.messages.defaultVolumeMax); if (args[2].length > 2) return msg.channel.send(client.messages.defaultVolumeMax);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
client.funcs.shuffle(queue.songs); client.funcs.shuffle(queue.songs);

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
const permissions = msg.channel.permissionsFor(msg.author); const permissions = msg.channel.permissionsFor(msg.author);
if (!queue || !queue.playing) return msg.channel.send(client.messages.noServerQueue); if (!queue || !queue.playing) return msg.channel.send(client.messages.noServerQueue);

View File

@ -6,17 +6,15 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = 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(`${client.messages.correctUsage}\`${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(client.messages.validNumber); if (isNaN(point)) return msg.channel.send(client.messages.validNumber);
if (point > queue.songs.size) return msg.channel.send(client.messages.noSongs); if (point > queue.songs.size) return msg.channel.send(client.messages.noSongs);
if (point < 1) return msg.channel.send(client.messages.cantSkipToCurrent); if (point < 0) return msg.channel.send(client.messages.cantSkipToCurrent);
let i = 0; for (let i = 0; i < point; i++) {
while (i < point) {
i++;
queue.songs.shift(); queue.songs.shift();
} }
queue.endReason = "skipto"; queue.endReason = "skipto";

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
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(client.messages.pinging).then(m => { msg.channel.send(client.messages.pinging).then(m => {
const latency = m.createdTimestamp - msg.createdTimestamp; const latency = m.createdTimestamp - msg.createdTimestamp;

View File

@ -6,7 +6,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_CHANNELS', permission: 'MANAGE_CHANNELS',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
queue.songs = []; queue.songs = [];

View File

@ -7,7 +7,7 @@ module.exports = {
onlyDev: false, onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music', category: 'music',
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue) return msg.channel.send(`${client.messages.currentVolume}**${queue.volume}**`); if (!args[1] && queue) return msg.channel.send(`${client.messages.currentVolume}**${queue.volume}**`);
const volume = parseFloat(args[1]); const volume = parseFloat(args[1]);

View File

@ -24,6 +24,6 @@ module.exports = {
if (!command && msg.content !== `${prefix}`) return; if (!command && msg.content !== `${prefix}`) return;
if (command.onlyDev && msg.author.id !== client.config.devId) return; if (command.onlyDev && msg.author.id !== client.config.devId) return;
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, command);
} }
} }

View File

@ -37,6 +37,9 @@ module.exports = {
dbl.postStats(client.guilds.size); dbl.postStats(client.guilds.size);
} }
console.log(`- Activated - Shard: ${client.shard.ids} -`); console.log(`- Activated - Shard: ${client.shard.ids} -`);
setInterval(() => {
client.funcs.checkDB(client);
}, 60000);
setInterval(async () => { setInterval(async () => {
client.funcs.saveDB(client); client.funcs.saveDB(client);
if (client.config.dblApi && !client.config.devMode) dbl.postStats(client.guilds.cache.size); if (client.config.dblApi && !client.config.devMode) dbl.postStats(client.guilds.cache.size);

View File

@ -2,8 +2,9 @@ module.exports = async function (client, reason, guild) {
const queue = client.queue.get(guild.id); const queue = client.queue.get(guild.id);
queue.playing = false; queue.playing = false;
if (reason === "seek") { if (reason === "seek") {
return; return queue.playing = true;
} }
if (!queue.songLooping) { if (!queue.songLooping) {
if (queue.looping) { if (queue.looping) {
queue.songs.push(queue.songs[0]); queue.songs.push(queue.songs[0]);

View File

@ -26,6 +26,7 @@ module.exports = class extends Client {
this.db = admin.firestore(); this.db = admin.firestore();
this.db.FieldValue = require('firebase-admin').firestore.FieldValue; this.db.FieldValue = require('firebase-admin').firestore.FieldValue;
this.dispatcher.finish = require('../events/dispatcherEvents/finish.js'); this.dispatcher.finish = require('../events/dispatcherEvents/finish.js');
this.dispatcher.error = require('../events/dispatcherEvents/error.js');
this.global = { this.global = {
db: { db: {
guilds: {}, guilds: {},

View File

@ -12,9 +12,11 @@ module.exports = {
devId: "360363051792203779", devId: "360363051792203779",
embedColor: "#b50002", embedColor: "#b50002",
invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot", invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot",
supportServer: "https://discord.gg/rvHuJtB",
devMode: false, devMode: false,
dblApi: false, dblApi: false,
saveDB: true, saveDB: true,
respawn: true,
shards: 10, shards: 10,
shardDelay: 10000, shardDelay: 10000,
spawnTimeout: 60000, spawnTimeout: 60000,

View File

@ -1,14 +1,13 @@
module.exports = { module.exports = {
alreadyPaused: "<:redx:674263474704220182> The music is already paused!", alreadyPaused: "<:redx:674263474704220182> The music is already paused!",
alreadyVoted: "<:redx:674263474704220182> You have already voted to skip!", alreadyVoted: "<:redx:674263474704220182> You have already voted to skip!",
announceSongs: "📣 Current setting:",
announceSongsFalse: "<:green_check_mark:674265384777416705> announcesongs now set to `false`!", announceSongsFalse: "<:green_check_mark:674265384777416705> announcesongs now set to `false`!",
announceSongsTrue: "<:green_check_mark:674265384777416705> announcesongs now set to `true`!", announceSongsTrue: "<:green_check_mark:674265384777416705> announcesongs now set to `true`!",
bassApplied: "<:volumehigh:674685637626167307> The bass level **%BASS%** will be applied when the next song starts playing!", bassApplied: "<:volumehigh:674685637626167307> The bass level **%BASS%** will be applied when the next song starts playing!",
bassFalse: "<:green_check_mark:674265384777416705> Bass is now false!", bassFalse: "<:green_check_mark:674265384777416705> Bass is now false!",
bassLevel: "<:green_check_mark:674265384777416705> Bass level is now", bassLevel: "<:green_check_mark:674265384777416705> Bass level is now",
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",
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!",
channelFull: "<:redx:674263474704220182> Your voice channel is full!", channelFull: "<:redx:674263474704220182> Your voice channel is full!",
@ -33,14 +32,15 @@ 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!",
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!",
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.",
helpTitle: "help", helpTitle: "help",
inviteTitle: "Invite Musix to your Discord server!", inviteTitle: "Invite Musix to your Discord server!",
joined: "<:green_check_mark:674265384777416705> Joined", joined: "<:green_check_mark:674265384777416705> Joined",
joinSupport: "Join the musix support server: ",
loadingSongs: "<a:loading:674284196700618783> Loading song(s)", loadingSongs: "<a:loading:674284196700618783> Loading song(s)",
looping: "<:repeat1:674685561377914892> Looping the queue now!", looping: "<:repeat1:674685561377914892> Looping the queue now!",
loopingSong: "<:repeatsong:674685573419761716> Looping **%TITLE%** now!", loopingSong: "<:repeatsong:674685573419761716> Looping **%TITLE%** now!",
@ -77,6 +77,7 @@ module.exports = {
positiveBass: "<:redx:674263474704220182> The bass needs to be a positive number!", positiveBass: "<:redx:674263474704220182> The bass needs to be a positive number!",
positiveVolume: "<:redx:674263474704220182> The volume needs to be a positive number!", positiveVolume: "<:redx:674263474704220182> The volume needs to be a positive number!",
prefixHere: "My prefix here is: ", prefixHere: "My prefix here is: ",
prefixMaxLength: "The prefix must be shorter or equal to 5 letters!",
prefixSet: "<:green_check_mark:674265384777416705> New prefix set to:", prefixSet: "<:green_check_mark:674265384777416705> New prefix set to:",
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!",
@ -96,7 +97,7 @@ module.exports = {
settingsAnnounceSongs: "announcesongs", settingsAnnounceSongs: "announcesongs",
settingsAnnounceSongsDesc: "Whether to announce songs that start playing or not.", settingsAnnounceSongsDesc: "Whether to announce songs that start playing or not.",
settingsBass: "bass", settingsBass: "bass",
settingsBassDesc: "Change the default bass level `Not supported`", settingsBassDesc: "Change the default bass level.",
settingsFooter: "how to use: %PREFIX%settings <Setting name> <value>", settingsFooter: "how to use: %PREFIX%settings <Setting name> <value>",
settingsPermissions: "permissions", settingsPermissions: "permissions",
settingsPermissionsDesc: "Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`", settingsPermissionsDesc: "Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`",

View File

@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "musix-248615",
"private_key_id": "2c30ab611233b72e89a992c802a8f8ad5bb2854c",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCrmJ92a7s+uKSu\nN0nfGyTpNNNbTbvowJ34mIUEsHUK39dq5aWqR7RSbpHv9RNn6zHHL4cAWpTLkj3z\n/FMOXgopgb01RcQ72pxN492fZb7ik4JRdvLe6dgeisH8tbbtk8c1lMLKJrjPJJqt\nCnihjzWbEmnVdZBMJMfYX3Q3cBVFFbV5n50ldaUXo62QLzvgkx7pOTPRDNFCla3l\nIgG0EhDopn5swl5V9Ebym1hjpsrDod7Ci6mj+stLgCuu5TllR9hI52g4oUqpoyfy\nqMXo5qUaKBVpBxE4zNKW+mlQDpAJVIrDktt0vWwzLY0aXJwjMJMhDLLu3yJWnpsn\n5rcUzohDAgMBAAECggEAAL7XI6a1BWW8PfzxgH/qHiL15mOAfjLLc8CZTaAODYtT\nsK57lMOn1wj7FHfvYcpV7XRQZ2a0Mn7Hb40zygbnavgsUmZ/VZqpYlE+G2GZD/vI\n7ZQ+2rlZEExVKo5RQUWKp0w5JiEa75Nw/boHxrPnkdtTDPOjFY9QfTtwW2JxIKRp\nzwl6cS3ESBVj1snF4I/QwCo+mIlBvJcPHvFmWJW8zf2thr+JU4iDFAz1GWh7KXLD\nPyYfg0w6baMuWeKAy9SkFynpKxiba7DCqp4NsSsNmkbKs2vaPRrZGGXIw9KItxFb\nHPkzXtUur/BXpCvfYN+KsyuYlorqklIRxXF/38N56QKBgQDt6qx/4bC/k7EmgdtA\nKZhR2X0KFaL0w+fCCFg/eqCs7xIK6msTbWNCgBwHk7N9L7Q6aW4NDhLeujDHl5Zn\nG8IL3O2XVQxKFKhyORe8Jr7BBtg+OTEsS+f618r6N0p7zJVNocaXPhRHvpD1J1w+\nyNHNOeVGFgtRhxKw8xQA+00ABQKBgQC4o4AbQs+HfxrNST/9Nkrt9k5s2f0TewJx\ntIAndNcHen6p2HlkqgdIiI7676tfXgwaFl/wV3SQ2NKMXXGpRMMj0Iz6PldEZIT8\navNH226+h1UgmMuJ5JhdHQ/RVDnl1vN7xrOuJ4U5BuOeS44QYiYgE5afdbmCXzgV\nSii+eB2BpwKBgQC5igrOjA5PyPkdI6X9irKsGiVGSQtVQLYrfmB72MEXPDXg52Fr\nvCHtiYTSb+BJH3u5FeFqMvCKW7+Q1+nGLUKOB9QN8Zhs6WFX+qhE5h5a4GChXe64\nMdYOrF0x9w6SL0C8Uw5RgmtEbBwV44UvvWLIXn8rwiM/iEwOTPLrtQ8elQKBgQCE\nErhNR8IpOxtR4ua52r9Ibpp0tI2aBLCf4yyUjLhPqii2l5lmD1W8ZapZB11/j0d6\n1ax0wCoqfl5Fd4YZPY2UrdZaHoPP8VNLN7mkGeuisC2Nbp6RmYn/eQ1agDQWG2b5\nkA3xMmXSgAILtiH9yCdbZIemstAq2K/GUtDIRiVdGwKBgQC3ahm4dP/Tf5y1YT3P\n0GD2vfppAGWW6m3anbV97IWzHdOb0lVNoPLi8RaCH60hqV7CewolOT2d/IwAPpJH\nlSAj5NM8wOU5LsBZQ9NO6FH6KtWErsC4wES8U6KI9enMViwG7E39EaCZ65A5VT7W\n0VL7SEPN9iYy882fYuTYqV2ogg==\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-zq2bj@musix-248615.iam.gserviceaccount.com",
"client_id": "112286897035848826432",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-zq2bj%40musix-248615.iam.gserviceaccount.com"
}

View File

@ -0,0 +1,4 @@
module.exports = {
ytdlOptions: { filter: "audio", highWaterMark: 1 << 25, volume: false, begin: null },
options: { seek: 0, bitrate: 1024, passes: 10, volume: 1, type: "converted" }
};

View File

@ -0,0 +1,11 @@
module.exports = async function (client) {
client.guilds.cache.forEach(guild => {
if (client.global.db.guilds[guild.id].prefix === undefined) client.global.db.guilds[guild.id].prefix = client.config.prefix;
if (client.global.db.guilds[guild.id].defaultVolume === undefined) client.global.db.guilds[guild.id].defaultVolume = client.config.defaultVolume;
if (client.global.db.guilds[guild.id].permissions === undefined) client.global.db.guilds[guild.id].permissions = client.config.permissions;
if (client.global.db.guilds[guild.id].dj === undefined) client.global.db.guilds[guild.id].dj = client.config.dj;
if (client.global.db.guilds[guild.id].djrole === undefined) client.global.db.guilds[guild.id].djrole = client.config.djrole;
if (client.global.db.guilds[guild.id].startPlaying === undefined) client.global.db.guilds[guild.id].startPlaying = client.config.startPlaying;
if (client.global.db.guilds[guild.id].bass === undefined) client.global.db.guilds[guild.id].bass = client.config.bass;
});
};

View File

@ -1,10 +1,10 @@
module.exports = function (msg, args, client, Discord, prefix, command) { module.exports = function (msg, args, client, Discord, 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(client.messages.noPermsEmbed); if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
if (!permissions.has('USE_EXTERNAL_EMOJIS')) return msg.channel.send(client.noPermsUseExternalEmojis); 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, command);
} catch (error) { } catch (error) {
const date = new Date(); const date = new Date();
msg.reply(client.messages.errorExe); msg.reply(client.messages.errorExe);

View File

@ -3,6 +3,7 @@ module.exports = async function (guild, song, client, seek, play) {
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const streamConfig = require("../config/streamConfig.js"); const streamConfig = require("../config/streamConfig.js");
const getThumb = require('video-thumbnail-url'); const getThumb = require('video-thumbnail-url');
const prism = require('prism-media');
const queue = client.queue.get(guild.id); const queue = client.queue.get(guild.id);
if (!song) { if (!song) {
@ -10,8 +11,21 @@ module.exports = async function (guild, song, client, seek, play) {
client.queue.delete(guild.id); client.queue.delete(guild.id);
return; return;
} }
streamConfig.ytdlOptions.begin = seek;
const ffmpegArgs = [
"-analyzeduration", "0",
"-loglevel", "0",
"-f", "s16le",
"-ar", "48000",
"-ac", "2",
"-af", `bass=g=${queue.bass}`
];
const transcoder = new prism.FFmpeg({ args: ffmpegArgs });
const dispatcher = queue.connection const dispatcher = queue.connection
.play(await ytdl(song.url, streamConfig.ytdlOptions), streamConfig.options).on("finish", () => { .play(await ytdl(song.url, streamConfig.ytdlOptions).pipe(transcoder), streamConfig.options).on("finish", () => {
client.dispatcher.finish(client, queue.endReason, guild); client.dispatcher.finish(client, queue.endReason, guild);
}).on('start', () => { }).on('start', () => {
dispatcher.player.streamingData.pausedTime = 0; dispatcher.player.streamingData.pausedTime = 0;

View File

@ -9,7 +9,7 @@ module.exports = async function (client) {
dj: client.global.db.guilds[guild.id].dj, dj: client.global.db.guilds[guild.id].dj,
djrole: client.global.db.guilds[guild.id].djrole, djrole: client.global.db.guilds[guild.id].djrole,
startPlaying: client.global.db.guilds[guild.id].startPlaying, startPlaying: client.global.db.guilds[guild.id].startPlaying,
//bass: client.global.db.guilds[guild.id].bass, bass: client.global.db.guilds[guild.id].bass,
}); });
}); });
} }

View File

@ -1,4 +0,0 @@
module.exports = {
ytdlOptions: { filter: "audio", highWaterMark: 1 << 25, volume: false/*, begin: seek*/ },
options: { seek: 0, bitrate: 1024, passes: 10, volume: 1/*, bassboost: queue.bass*/ }
};