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

Fix code to work on this decade 1/x

This commit is contained in:
Christer Warén 2024-02-10 09:33:59 +02:00
parent 99ecd9787d
commit 86b4676159
61 changed files with 3842 additions and 471 deletions

View File

@ -1,15 +1 @@
# Musix-V3 # Musix OSS - V3
## Discord music bot
Third version of Musix discord music bot.
Made with discord.js V12
## Installation
npm install (idk how yarn works)
## Usage
You will need you own .env file and serviceAccount.json for database!

View File

@ -1,15 +1,12 @@
const config = require("./src/struct/config/config.js"); const { ShardingManager} = require("discord.js");
const config = require("./src/config/config.js");
const DiscordWebhook = require("discord-webhook-node"); const DiscordWebhook = require("discord-webhook-node");
if (config.devMode) { if (config.devMode) {
console.log("- dev mode- "); console.log("- dev mode- ");
config.token = config.devToken;
config.shards = 1; config.shards = 1;
} }
const {
ShardingManager
} = require("discord.js");
const manager = new ShardingManager("./src/bot.js", { const manager = new ShardingManager("./src/bot.js", {
token: config.token, token: config.token,
respawn: config.respawn, respawn: config.respawn,
@ -22,19 +19,13 @@ manager.on("shardCreate", (shard) =>
console.log(`- Launched shard ${shard.id} -`) console.log(`- Launched shard ${shard.id} -`)
); );
const webhookClient = new DiscordWebhook.Webhook(config.webhookUrl);
const oldConsole = {}; const oldConsole = {};
oldConsole.log = console.log; oldConsole.log = console.log;
console.log = function (arg) { console.log = function (arg) {
oldConsole.log(arg); oldConsole.log(arg);
if (!config.devMode && arg)
webhookClient.send(JSON.stringify(arg));
}; };
oldConsole.error = console.error; oldConsole.error = console.error;
console.error = function (arg) { console.error = function (arg) {
oldConsole.error(arg); oldConsole.error(arg);
if (!config.devMode && arg) };
webhookClient.send(JSON.stringify(arg));
};

3690
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +1,39 @@
{ {
"name": "musix", "name": "musix-oss",
"version": "3.10.2", "version": "3.11.0",
"description": "V3 for Musix the discord music bot", "description": "V3 for Musix the discord music bot",
"main": "./index.js", "main": "./index.js",
"scripts": { "scripts": {
"start": "node --max-old-space-size=3072 index.js" "start": "node --max-old-space-size=3072 index.js",
"start:dev": "nodemon"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/MatteZ02/Musix-V3.git" "url": "git+https://github.com/musix-org/musix-oss.git"
}, },
"author": "Matte", "author": "Musix Org",
"license": "ISC", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/MatteZ02/Musix-V3/issues", "url": "https://github.com/musix-org/musix-oss/issues",
"support": "https://discord.gg/rvHuJtB" "support": "https://discord.gg/rvHuJtB"
}, },
"homepage": "https://musix-web.herokuapp.com/", "homepage": "https://musix-org.github.io/",
"dependencies": { "dependencies": {
"@discordjs/opus": "^0.9.0", "@discordjs/opus": "^0.9.0",
"bodapi.js": "^1.1.1",
"bufferutil": "^4.0.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dblapi.js": "^2.4.0",
"discord-webhook-node": "^1.1.8", "discord-webhook-node": "^1.1.8",
"discord.js": "^14.14.1", "discord.js": "^14.14.1",
"dotenv": "^16.4.1", "dotenv": "^16.4.1",
"erlpack": "github:discordapp/erlpack",
"express": "^4.17.1",
"firebase": "^10.8.0", "firebase": "^10.8.0",
"firebase-admin": "^12.0.0", "firebase-admin": "^12.0.0",
"fs": "0.0.1-security",
"genius-lyrics-api": "^3.2.0",
"he": "^1.2.0", "he": "^1.2.0",
"libsodium-wrappers": "^0.7.6", "prism-media": "^1.3.5",
"ms": "^2.1.2",
"node-spotify-api": "^1.1.1",
"prism-media": "github:hydrabolt/prism-media",
"request": "^2.88.2", "request": "^2.88.2",
"similar-songs": "^0.1.3",
"simple-youtube-api": "^5.2.1", "simple-youtube-api": "^5.2.1",
"soundcloud-api-client": "0.0.9",
"spotify-web-api-node": "^5.0.2", "spotify-web-api-node": "^5.0.2",
"utf-8-validate": "^6.0.3",
"ytdl-core": "^4.11.5", "ytdl-core": "^4.11.5",
"ytsr": "^3.8.4", "ytsr": "^3.8.4"
"zlib-sync": "^0.1.7" },
"devDependencies": {
"nodemon": "^3.0.3"
} }
} }

View File

@ -1,19 +1,14 @@
const MusicClient = require("./struct/client.js"); const MusicClient = require("./client.js");
const DiscordWebhook = require("discord-webhook-node"); const DiscordWebhook = require("discord-webhook-node");
const client = new MusicClient({}); const client = new MusicClient({});
const webhookClient = new DiscordWebhook.Webhook(client.config.webhookUrl);
const oldConsole = {}; const oldConsole = {};
oldConsole.log = console.log; oldConsole.log = console.log;
console.log = function (arg) { console.log = function (arg) {
oldConsole.log(arg); oldConsole.log(arg);
if (!client.config.devMode && arg)
webhookClient.send(JSON.stringify(arg));
}; };
oldConsole.error = console.error; oldConsole.error = console.error;
console.error = function (arg) { console.error = function (arg) {
oldConsole.error(arg); oldConsole.error(arg);
if (!client.config.devMode && arg) };
webhookClient.send(JSON.stringify(arg));
};

View File

@ -15,13 +15,14 @@ const GatewayIntents = new Intents();
GatewayIntents.add( GatewayIntents.add(
1 << 0, // GUILDS 1 << 0, // GUILDS
1 << 7, // GUILD_VOICE_STATES 1 << 7, // GUILD_VOICE_STATES
1 << 9, // GUILD_MESSAGES 1 << 9, // GUILD_MESSAGES,
1 << 15 // MESSAGE_CONTENT
); );
module.exports = class extends Client { module.exports = class extends Client {
constructor() { constructor() {
super({ super({
disableEveryone: true, disableMentions: "everyone",
disabledEvents: ["TYPING_START"], disabledEvents: ["TYPING_START"],
ws: { ws: {
intents: GatewayIntents intents: GatewayIntents
@ -38,7 +39,7 @@ module.exports = class extends Client {
id: config.spotify_client_id, id: config.spotify_client_id,
secret: config.spotify_client_secret, secret: config.spotify_client_secret,
}); });
this.youtube = new YouTube(config.api_keys[(this.shard.ids / 2).toFixed()] || config.api_key); this.youtube = new YouTube(config.youtube_api_key);
this.config = config; this.config = config;
this.funcs = {}; this.funcs = {};
this.dispatcher = {}; this.dispatcher = {};
@ -48,7 +49,7 @@ module.exports = class extends Client {
this.global = { this.global = {
db: { db: {
guilds: {}, guilds: {},
}, }
}; };
this.logs = []; this.logs = [];
@ -71,14 +72,11 @@ module.exports = class extends Client {
const option = require(`../commands/settings/${file}`); const option = require(`../commands/settings/${file}`);
this.settingCmd.set(option.name, option); this.settingCmd.set(option.name, option);
} }
if (this.config.devMode) {
this.config.token = this.config.devToken;
}
require("../events/clientEvents/handler.js")(this); require("./events/clientEvents/handler.js")(this);
this.login(this.config.token).catch((err) => this.login(this.config.discord_api_token).catch((err) =>
console.log("Failed to login: " + err) console.log("Failed to login: " + err)
); );
} }
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
description: "Boost the bass in your music!", description: "Boost the bass in your music!",
alias: ["none"], alias: ["none"],
usage: "<bass>", usage: "<bass>",
onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "audio modifiers", category: "audio modifiers",
execute(msg, args, client, Discord, command) { execute(msg, args, client, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue) if (!args[1] && queue)
return msg.channel.send( return msg.channel.send(
@ -31,4 +30,4 @@ module.exports = {
return msg.channel.send(message); return msg.channel.send(message);
} }
}, },
}; };

View File

@ -1,31 +0,0 @@
module.exports = {
name: 'cmduses',
alias: ["none"],
usage: '',
description: 'list all commands and how many times they\'ve been used',
onlyDev: true,
permission: 'dev',
category: 'util',
async execute(msg, args, client, Discord, command) {
const cmduses = [];
client.commands.forEach((value, key) => {
cmduses.push([key, value.uses]);
});
cmduses.sort((a, b) => {
return b[1] - a[1];
});
const cmdnamelength = Math.max(...cmduses.map(x => x[0].length)) + 4;
const numberlength = Math.max(...cmduses.map(x => x[1].toString().length), 4);
const markdownrows = ['Command' + ' '.repeat(cmdnamelength - 'command'.length) + ' '.repeat(numberlength - 'uses'.length) + 'Uses'];
cmduses.forEach(x => {
if (x[1] > 0) markdownrows.push(x[0] + '.'.repeat(cmdnamelength - x[0].length) + ' '.repeat(numberlength - x[1].toString().length) + x[1].toString());
});
const embed = new Discord.MessageEmbed();
embed
.setTitle(client.messages.cmdUsesTitle)
.setDescription('```ml\n' + markdownrows.join('\n') + '\n```')
.setFooter(client.messages.cmdUsesFooter)
.setColor(client.config.embedColor);
msg.channel.send(embed);
},
};

View File

@ -1,23 +0,0 @@
module.exports = {
name: 'eval',
alias: ["none"],
usage: '<code>',
description: 'Evaluation command. DEV ONLY!',
onlyDev: true,
permission: 'dev',
category: 'util',
async execute(msg, args, client, Discord, command) {
const input = msg.content.slice(client.global.db.guilds[msg.guild.id].prefix.length + 5);
let output;
try {
output = await eval(input);
} catch (error) {
output = error.toString();
}
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.evalTitle)
.setColor(client.config.embedColor)
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
return msg.channel.send(embed);
},
};

View File

@ -1,19 +1,20 @@
const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: 'help', name: 'help',
alias: ["h"], alias: ["h"],
usage: '<command(opt)>', usage: '<command(opt)>',
description: 'See the help for Musix.', description: 'See the help for Musix.',
onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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]);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(`${client.global.db.guilds[msg.guild.id].prefix}${command.name} ${command.usage}`) .setTitle(`${client.global.db.guilds[msg.guild.id].prefix}${command.name} ${command.usage}`)
.setDescription(command.description) .setDescription(command.description)
.setFooter(`${client.messages.helpCmdFooter} \`${command.alias.map(a => `${a}, `)}\``) .setFooter({ text:`${client.messages.helpCmdFooter} \`${command.alias.map(a => `${a}, `)}\`` })
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
} else { } else {
@ -23,16 +24,16 @@ module.exports = {
} }
let commands = ''; let commands = '';
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).map(x => `\`${x.name}\``).join(', ')}\n`;
} }
let message; let message;
message = client.messages.helpFooter.replace("%PREFIX%", client.global.db.guilds[msg.guild.id].prefix); message = client.messages.helpFooter.replace("%PREFIX%", client.global.db.guilds[msg.guild.id].prefix);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(`${client.user.username} ${client.messages.helpTitle}`) .setTitle(`${client.user.username} ${client.messages.helpTitle}`)
.setDescription(commands) .setDescription(commands)
.setFooter(message) .setFooter({ text: message })
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
} }
} }
}; };

View File

@ -1,16 +1,17 @@
const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: 'invite', name: 'invite',
alias: ["i"], alias: ["i"],
usage: '', usage: '',
description: 'Invite Musix.', description: 'Invite Musix.',
onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(msg, args, client, Discord, command) { execute(msg, args, client, command) {
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.inviteTitle) .setTitle(client.messages.inviteTitle)
.setURL(client.config.invite) .setURL(client.config.invite)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
} }
}; };

View File

@ -1,24 +0,0 @@
module.exports = {
name: 'join',
alias: ["j"],
usage: '',
description: 'Make Musix join your voice channel.',
onlyDev: true,
permission: 'none',
category: 'util',
async execute(msg, args, client, Discord, command) {
try {
const queue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
const connection = await voiceChannel.join();
if (queue) {
queue.connection = connection;
}
msg.channel.send(`${client.messages.joined} ${voiceChannel.name}!`);
} catch (error) {
client.queue.delete(msg.guild.id);
console.log(error);
return msg.channel.send(client.messages.error);
}
}
};

View File

@ -3,10 +3,9 @@ module.exports = {
alias: [], alias: [],
usage: '', usage: '',
description: 'loop the queue.', description: 'loop the queue.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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) {
@ -18,4 +17,4 @@ module.exports = {
} }
} }
} }
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["none"], alias: ["none"],
usage: '', usage: '',
description: 'loop the currently playing song.', description: 'loop the currently playing song.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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) {
@ -20,4 +19,4 @@ module.exports = {
} }
} }
} }
}; };

View File

@ -1,3 +1,4 @@
const { EmbedBuilder } = require("discord.js");
const { getLyrics } = require("genius-lyrics-api"); const { getLyrics } = require("genius-lyrics-api");
module.exports = { module.exports = {
@ -5,10 +6,9 @@ module.exports = {
alias: ["l"], alias: ["l"],
usage: "<song>", usage: "<song>",
description: "see the lyrics for a song", description: "see the lyrics for a song",
onlyDev: false,
permission: "none", permission: "none",
category: "util", category: "util",
async execute(msg, args, client, Discord, prefix, command) { async execute(msg, args, client, prefix, command) {
const searchString = args.slice(1).join(" "); const searchString = args.slice(1).join(" ");
const options = { const options = {
apiKey: client.config.genius_api_key, apiKey: client.config.genius_api_key,
@ -26,7 +26,7 @@ module.exports = {
for (let i = 0; i < lyrics.length; i += 2000) { for (let i = 0; i < lyrics.length; i += 2000) {
let toi = ""; let toi = "";
toi = lyrics.substring(i, Math.min(lyrics.length, i + 2000)); toi = lyrics.substring(i, Math.min(lyrics.length, i + 2000));
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.lyricsTitle) .setTitle(client.messages.lyricsTitle)
.setDescription(toi) .setDescription(toi)
.setColor(client.config.embedColor); .setColor(client.config.embedColor);

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["nc"], alias: ["nc"],
usage: "<true/false>", usage: "<true/false>",
description: "Change nightcore audio modifier on/off", description: "Change nightcore audio modifier on/off",
onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "audio modifiers", category: "audio modifiers",
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue) if (!args[1] && queue)
return msg.channel.send( return msg.channel.send(
@ -23,4 +22,4 @@ module.exports = {
return msg.channel.send(message); return msg.channel.send(message);
} }
}, },
}; };

View File

@ -1,12 +1,13 @@
const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: "nowplaying", name: "nowplaying",
alias: ["np", "playing"], alias: ["np", "playing"],
usage: "", usage: "",
description: "See the currently playing song position and length.", description: "See the currently playing song position and length.",
onlyDev: false,
permission: "none", permission: "none",
category: "info", category: "info",
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, command) {
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
if (!queue || !queue.songs[0] || !queue.connection || !queue.connection.dispatcher) return msg.channel.send(client.messages.noServerQueue); if (!queue || !queue.songs[0] || !queue.connection || !queue.connection.dispatcher) return msg.channel.send(client.messages.noServerQueue);
let songTime = (queue.songs[0].info.lengthSeconds * 1000).toFixed(0); let songTime = (queue.songs[0].info.lengthSeconds * 1000).toFixed(0);
@ -24,7 +25,7 @@ module.exports = {
array.push("⎯"); array.push("⎯");
} }
const thumbnail = queue.songs[0].info.thumbnail.thumbnails[4] || queue.songs[0].info.thumbnail.thumbnails[3] || queue.songs[0].info.thumbnail.thumbnails[2] || queue.songs[0].info.thumbnail.thumbnails[1] || queue.songs[0].info.thumbnail.thumbnails[0]; const thumbnail = queue.songs[0].info.thumbnail.thumbnails[4] || queue.songs[0].info.thumbnail.thumbnails[3] || queue.songs[0].info.thumbnail.thumbnails[2] || queue.songs[0].info.thumbnail.thumbnails[1] || queue.songs[0].info.thumbnail.thumbnails[0];
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.nowPlaying) .setTitle(client.messages.nowPlaying)
.setDescription( .setDescription(
`${client.messages.nowPlayingDesc} ${ `${client.messages.nowPlayingDesc} ${
@ -34,7 +35,7 @@ module.exports = {
"hh:mm:ss" "hh:mm:ss"
)} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\`\nchannel: \`${queue.songs[0].info.author.name}\`` )} / ${client.funcs.msToTime(songTime, "hh:mm:ss")}\`\nchannel: \`${queue.songs[0].info.author.name}\``
) )
.setFooter(`Queued by ${queue.songs[0].author.tag}`) .setFooter({ text: `Queued by ${queue.songs[0].author.tag}`})
.setURL(queue.songs[0].url) .setURL(queue.songs[0].url)
.setThumbnail(thumbnail.url) .setThumbnail(thumbnail.url)
.setColor(client.config.embedColor); .setColor(client.config.embedColor);
@ -44,4 +45,4 @@ module.exports = {
); );
return msg.channel.send(embed); return msg.channel.send(embed);
}, },
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["none"], alias: ["none"],
usage: '', usage: '',
description: 'Pause the currently playing music.', description: 'Pause the currently playing music.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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);
@ -15,4 +14,4 @@ module.exports = {
return msg.channel.send(client.messages.paused); return msg.channel.send(client.messages.paused);
} }
} }
}; };

View File

@ -6,10 +6,9 @@ module.exports = {
alias: ["p", "music"], alias: ["p", "music"],
usage: "<song name>", usage: "<song name>",
description: "Play some music.", description: "Play some music.",
onlyDev: false,
permission: "none", permission: "none",
category: "play", category: "play",
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, command) {
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") : "";
const queue = client.queue.get(msg.guild.id); const queue = client.queue.get(msg.guild.id);
@ -399,4 +398,4 @@ async function searchSong(data, client, msg, voiceChannel) {
)}\n${client.messages.failedToLoad + failed}`; )}\n${client.messages.failedToLoad + failed}`;
} }
lmsg.edit(message); lmsg.edit(message);
} }

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["prev", "return", "back"], alias: ["prev", "return", "back"],
usage: '', usage: '',
description: 'Play the previous song.', description: 'Play the previous song.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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.prevSongs.length < 1) return msg.channel.send(client.messages.noPreviousSongs); if (queue.prevSongs.length < 1) return msg.channel.send(client.messages.noPreviousSongs);
@ -15,4 +14,4 @@ module.exports = {
msg.channel.send(client.messages.previousSong) msg.channel.send(client.messages.previousSong)
} }
} }
}; };

View File

@ -1,12 +1,13 @@
const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: 'queue', name: 'queue',
alias: ["q", "list", "ls", "songs"], alias: ["q", "list", "ls", "songs"],
usage: '', usage: '',
description: 'See the queue.', description: 'See the queue.',
onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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;
@ -18,11 +19,11 @@ module.exports = {
} }
let message; let message;
message = client.messages.queueDesc.replace("%SONG%", queue.songs[0].title); message = client.messages.queueDesc.replace("%SONG%", queue.songs[0].title);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.queueTitle) .setTitle(client.messages.queueTitle)
.setDescription(`${message}\n${queuemessage}`) .setDescription(`${message}\n${queuemessage}`)
.setFooter(`${queue.songs.length - 1} ${client.messages.queueFooter}`) .setFooter({ text: `${queue.songs.length - 1} ${client.messages.queueFooter}`})
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
return msg.channel.send(embed); return msg.channel.send(embed);
} }
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["rm", "delete", "del"], alias: ["rm", "delete", "del"],
usage: "<song pos>", usage: "<song pos>",
description: "Remove a song from the queue", description: "Remove a song from the queue",
onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "music control", category: "music control",
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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);
@ -29,4 +28,4 @@ module.exports = {
return queue.songs.splice(pos, 1); return queue.songs.splice(pos, 1);
} }
}, },
}; };

View File

@ -3,14 +3,13 @@ module.exports = {
alias: ["rp"], alias: ["rp"],
usage: '', usage: '',
description: 'Replay the currently playing song.', description: 'Replay the currently playing song.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'play', category: 'play',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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.endReason = "replay"; queue.endReason = "replay";
queue.connection.dispatcher.end() queue.connection.dispatcher.end()
} }
} }
}; };

View File

@ -1,15 +0,0 @@
module.exports = {
name: 'restart',
alias: ["none"],
usage: '',
description: 'restart all shards',
onlyDev: true,
permission: 'dev',
category: 'util',
async execute(msg, args, client, Discord, command) {
client.shard.broadcastEval("this.funcs.saveDB(this);");
msg.channel.send(client.messages.dbSaved);
msg.channel.send(client.messages.restart);
client.shard.respawnAll(client.config.shardDelay, client.config.respawnDelay, client.config.spawnTimeout);
}
};

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["continue"], alias: ["continue"],
usage: '', usage: '',
description: 'Resume the paused music.', description: 'Resume the paused music.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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);
@ -15,4 +14,4 @@ module.exports = {
return msg.channel.send(client.messages.resumed); return msg.channel.send(client.messages.resumed);
} }
} }
}; };

View File

@ -1,13 +0,0 @@
module.exports = {
name: 'savedb',
alias: ["none"],
usage: '',
description: 'save the database',
onlyDev: true,
permission: 'dev',
category: 'util',
async execute(msg, args, client, Discord, command) {
client.funcs.saveDB(client);
msg.channel.send(client.messages.dbSaved);
}
};

View File

@ -1,15 +1,15 @@
const ytsr = require('ytsr'); const ytsr = require('ytsr');
const he = require('he'); const he = require('he');
const { EmbedBuilder } = require('discord.js');
module.exports = { module.exports = {
name: 'search', name: 'search',
alias: ["sr", "find"], alias: ["sr", "find"],
usage: '<search word(s)>', usage: '<search word(s)>',
description: 'Search the top 10 queryes and choose one.', description: 'Search the top 10 queryes and choose one.',
onlyDev: false,
permission: 'none', permission: 'none',
category: 'play', category: 'play',
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, command) {
const searchString = args.slice(1).join(" "); const searchString = args.slice(1).join(" ");
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;
@ -30,10 +30,10 @@ module.exports = {
const videoResults = res.items.filter(item => item.type === "video"); const videoResults = res.items.filter(item => item.type === "video");
const videos = videoResults.slice(0, 10); const videos = videoResults.slice(0, 10);
let index = 0; let index = 0;
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.songSelection) .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(client.messages.provideANumber) .setFooter({ text: client.messages.provideANumber })
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
try { try {
@ -58,4 +58,4 @@ module.exports = {
}); });
}) })
} }
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["none"], alias: ["none"],
usage: "<point in song (seconds)>", usage: "<point in song (seconds)>",
description: "Seek to a specific point in the currently playing song.", description: "Seek to a specific point in the currently playing song.",
onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "music control", category: "music control",
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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.nightCore) if (queue.nightCore)

View File

@ -1,60 +1,32 @@
const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: "settings", name: "settings",
alias: ["options", "ops", "preferences"], alias: ["options", "ops", "preferences"],
usage: "<setting> <value(opt)>", usage: "<setting> <value(opt)>",
description: "Change the server settings for Musix.", description: "Change the server settings for Musix.",
onlyDev: false,
permission: "MANAGE_GUILD", permission: "MANAGE_GUILD",
category: "util", category: "util",
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, command) {
let footer; let footer;
footer = client.messages.settingsFooter.replace( footer = client.messages.settingsFooter.replace(
"%PREFIX%", "%PREFIX%",
client.global.db.guilds[msg.guild.id].prefix client.global.db.guilds[msg.guild.id].prefix
); );
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.settingsTitle) .setTitle(client.messages.settingsTitle)
.addField( .addFields(
client.messages.settingsPrefix, { name: client.messages.settingsPrefix, value: client.messages.settingsPrefixDesc, inline: true },
client.messages.settingsPrefixDesc, { name: client.messages.settingsVolume, value: client.messages.settingsVolumeDesc, inline: true },
true { name: client.messages.settingsBlacklist, value: client.messages.settingsBlacklistDesc, inline: true },
{ name: client.messages.settingsPermissions, value: client.messages.settingsPermissionsDesc, inline: true },
{ name: client.messages.settingsSetDj, value: client.messages.settingsSetDjDesc, inline: true },
{ name: client.messages.settingsAnnounceSongs, value: client.messages.settingsAnnounceSongsDesc },
{ name: client.messages.settingsBass, value: client.messages.settingsBassDesc, inline: true },
{ name: client.messages.settingsAutoPlay, value: client.messages.settingsAutoPlayDesc, inline: true }
) )
.addField( .setFooter({ text: footer })
client.messages.settingsVolume, .setAuthor({ name: client.user.username, iconURL: client.user.avatarURL() })
client.messages.settingsVolumeDesc,
true
)
.addField(
client.messages.settingsBlacklist,
client.messages.settingsBlacklistDesc,
true
)
.addField(
client.messages.settingsPermissions,
client.messages.settingsPermissionsDesc,
true
)
.addField(
client.messages.settingsSetDj,
client.messages.settingsSetDjDesc,
true
)
.addField(
client.messages.settingsAnnounceSongs,
client.messages.settingsAnnounceSongsDesc
)
.addField(
client.messages.settingsBass,
client.messages.settingsBassDesc,
true
)
.addField(
client.messages.settingsAutoPlay,
client.messages.settingsAutoPlayDesc,
true
)
.setFooter(footer)
.setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor(client.config.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) {

View File

@ -1,4 +1,4 @@
const discord = require("discord.js"); const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: "blacklist", name: "blacklist",
@ -89,7 +89,7 @@ module.exports = {
} }
break; break;
case "list": case "list":
embed = new discord.MessageEmbed() embed = new EmbedBuilder()
.setTitle(client.messages.blacklistTitle) .setTitle(client.messages.blacklistTitle)
.setDescription( .setDescription(
`${client.global.db.guilds[msg.guild.id].blacklist `${client.global.db.guilds[msg.guild.id].blacklist
@ -100,17 +100,16 @@ module.exports = {
msg.channel.send(embed); msg.channel.send(embed);
break; break;
case undefined: case undefined:
embed = new discord.MessageEmbed() embed = new EmbedBuilder()
.setTitle(client.messages.blacklistTitle) .setTitle(client.messages.blacklistTitle)
.addField("add", "Add a channel to the blacklist. (ID or mention)") .addFields(
.addField( { name: "add", value: "Add a channel to the blacklist. (ID or mention)" },
"remove", { name: "remove", value: "Remove a channel from the blacklist. (ID or mention)" },
"Remove a channel from the blacklist. (ID or mention)" { name: "list", value: "List the currently blacklisted channels." }
) )
.addField("list", "List the currently blacklisted channels.")
.setColor(client.config.embedColor); .setColor(client.config.embedColor);
msg.channel.send(embed); msg.channel.send(embed);
break; break;
} }
}, },
}; };

View File

@ -6,8 +6,6 @@ module.exports = {
client.messages.premiumState + client.messages.premiumState +
client.global.db.guilds[msg.guild.id].premium client.global.db.guilds[msg.guild.id].premium
); );
if (msg.member.id !== client.config.devId)
return msg.channel.send(client.messages.onlyDev);
if (client.global.db.guilds[args[2]].premium === false) { if (client.global.db.guilds[args[2]].premium === false) {
client.global.db.guilds[args[2]].premium = true; client.global.db.guilds[args[2]].premium = true;
let message; let message;

View File

@ -3,14 +3,13 @@ module.exports = {
alias: ["none"], alias: ["none"],
usage: '', usage: '',
description: 'Shuffle the queue.', description: 'Shuffle the queue.',
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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);
msg.channel.send(client.messages.shuffled); msg.channel.send(client.messages.shuffled);
} }
} }
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["s", "next"], alias: ["s", "next"],
usage: "", usage: "",
description: "Skip the currently playing song.", description: "Skip the currently playing song.",
onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "music control", category: "music control",
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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) if (!queue || !queue.playing)
@ -61,4 +60,4 @@ function vote(queue, msg, client) {
} else { } else {
return skipSong(queue, msg, client); return skipSong(queue, msg, client);
} }
} }

View File

@ -3,10 +3,9 @@ module.exports = {
alias: ["st"], alias: ["st"],
usage: "<point in queue>", usage: "<point in queue>",
description: "Skip to a point in the queue", description: "Skip to a point in the queue",
onlyDev: false,
permission: "MANAGE_MESSAGES", permission: "MANAGE_MESSAGES",
category: "music control", category: "music control",
async execute(msg, args, client, Discord, command) { async execute(msg, args, client, 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]) if (!args[1])
@ -28,4 +27,4 @@ module.exports = {
queue.connection.dispatcher.end(); queue.connection.dispatcher.end();
} }
}, },
}; };

View File

@ -1,28 +0,0 @@
module.exports = {
name: "soundcloud",
alias: ["none"],
usage: "",
description: "",
onlyDev: true,
permission: "dev",
category: "play",
async execute(msg, args, client, Discord, prefix, command) {
if (!args[1]) return msg.channel.send(client.messages.noQuery);
const SoundCloud = require("soundcloud-api-client");
const key = client.config.soundCloud_api_key;
const soundcloud = new SoundCloud({
key
});
const q = "live mix";
const genres = ["house", "tech-house", "techno"].join(",");
soundcloud
.get("/tracks", {
q,
genres
})
.then((tracks) => console.log(tracks))
.catch((e) => console.error(e));
},
};

View File

@ -1,26 +1,29 @@
const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: 'status', name: 'status',
alias: ["stats", "info"], alias: ["stats", "info"],
usage: '', usage: '',
description: 'See the current status for Musix.', description: 'See the current status for Musix.',
onlyDev: false,
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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;
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.statusTitle) .setTitle(client.messages.statusTitle)
.addField(client.messages.statusField1, client.ws.ping, true) .addFields(
.addField(client.messages.statusField2, latency, true) { name: client.messages.statusField1, value: client.ws.ping, inline: true },
.addField(client.messages.statusField3, uptime, true) { name: client.messages.statusField2, value: latency, inline: true },
.addField(client.messages.statusField4, client.shard.ids) { name: client.messages.statusField3, value: uptime, inline: true },
.setAuthor(client.user.username, client.user.displayAvatarURL) { name: client.messages.statusField4, value: client.shard.ids },
)
.setAuthor({ name: client.user.username, iconURL: client.user.avatarURL() })
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
m.delete(); m.delete();
return msg.channel.send(embed); return msg.channel.send(embed);
}); });
} }
}; };

View File

@ -3,10 +3,9 @@ module.exports = {
description: 'Stop the music and clear the queue.', description: 'Stop the music and clear the queue.',
alias: ["none"], alias: ["none"],
usage: '', usage: '',
onlyDev: false,
permission: 'MANAGE_CHANNELS', permission: 'MANAGE_CHANNELS',
category: 'music control', category: 'music control',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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 (msg.content.includes("-force")) { if (msg.content.includes("-force")) {
@ -28,4 +27,4 @@ module.exports = {
msg.channel.send(client.messages.stop); msg.channel.send(client.messages.stop);
} }
} }
}; };

View File

@ -1,29 +0,0 @@
module.exports = {
name: 'system',
alias: ["sys", "sysinfo"],
usage: '',
description: 'See system information',
onlyDev: true,
permission: 'none',
category: 'info',
execute(msg, args, client, Discord, command) {
const uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss");
msg.channel.send(client.messages.pinging).then(m => {
const latency = m.createdTimestamp - msg.createdTimestamp;
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.statusTitle)
.addField(client.messages.statusField1, client.ws.ping, true)
.addField(client.messages.statusField2, latency, true)
.addField(client.messages.statusField3, uptime, true)
.addField(client.messages.statusField4, client.shard.ids)
.addField("ram usage", `${process.memoryUsage().heapUsed} / ${process.memoryUsage().heapTotal}`, true)
.addField("cpu usage", process.cpuUsage().system, true)
.addField("version", require("../../package.json").version, true)
.setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor(client.config.embedColor)
m.delete();
return msg.channel.send(embed);
});
}
};

View File

@ -4,10 +4,9 @@ module.exports = {
alias: ["none"], alias: ["none"],
usage: '<volume>', usage: '<volume>',
cooldown: 5, cooldown: 5,
onlyDev: false,
permission: 'MANAGE_MESSAGES', permission: 'MANAGE_MESSAGES',
category: 'music control', category: 'music control',
execute(msg, args, client, Discord, command) { execute(msg, args, client, 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]);
@ -20,4 +19,4 @@ module.exports = {
return msg.channel.send(`${client.messages.setVolume}**${volume}**`); return msg.channel.send(`${client.messages.setVolume}**${volume}**`);
} }
} }
}; };

View File

@ -1,21 +1,17 @@
require("dotenv/config"); require("dotenv/config");
module.exports = { module.exports = {
token: process.env.TOKEN, discord_api_token: process.env.DISCORD_API_TOKEN,
devToken: process.env.DEVTOKEN,
dblKey: process.env.DBLKEY,
bodKey: process.env.BODKEY, bodKey: process.env.BODKEY,
api_key: process.env.GOOGLE_API_KEY, youtube_api_key: process.env.YOUTUBE_API_KEY,
api_keys: [process.env.GOOGLE_API_KEY1, process.env.GOOGLE_API_KEY2, process.env.GOOGLE_API_KEY3, process.env.GOOGLE_API_KEY4, process.env.GOOGLE_API_KEY5, process.env.GENIUS_API_KEY6],
genius_api_key: process.env.GENIUS_API_KEY, genius_api_key: process.env.GENIUS_API_KEY,
soundCloud_api_key: process.env.SOUNDCLOUD_API_KEY, soundcloud_api_key: process.env.SOUNDCLOUD_API_KEY,
spotify_access_key: process.env.SPOTIFY_ACCESS_KEY, spotify_access_key: process.env.SPOTIFY_ACCESS_KEY,
spotify_client_secret: process.env.SPOTIFY_CLIENT_SECRET, spotify_client_secret: process.env.SPOTIFY_CLIENT_SECRET,
spotify_client_id: process.env.SPOTIFY_CLIENT_ID, spotify_client_id: process.env.SPOTIFY_CLIENT_ID,
spotify_refresh_token: process.env.SPOTIFY_REFRESH_TOKEN, spotify_refresh_token: process.env.SPOTIFY_REFRESH_TOKEN,
lastfm_api_key: process.env.LASTFM_API_KEY, lastfm_api_key: process.env.LASTFM_API_KEY,
lastfm_secret: process.env.LASTFM_SECRET, lastfm_secret: process.env.LASTFM_SECRET,
webhookUrl: process.env.WEBHOOK_URL,
port: 8888, port: 8888,
redirectUri: "http://localhost:8888/callback/", redirectUri: "http://localhost:8888/callback/",
testServer: "489111553321336832", testServer: "489111553321336832",
@ -100,4 +96,4 @@ module.exports.emojis = {
stop: "<:stop:674685626108477519> ", stop: "<:stop:674685626108477519> ",
stopWatch: ":stopwatch: ", stopWatch: ":stopwatch: ",
volumeHigh: "<:volumehigh:674685637626167307> ", volumeHigh: "<:volumehigh:674685637626167307> ",
}; };

View File

@ -122,7 +122,6 @@ module.exports = {
"I'm sorry but you need to be in a voice channel to play music!", "I'm sorry but you need to be in a voice channel to play music!",
nowPlaying: "__Now playing__", nowPlaying: "__Now playing__",
nowPremium: ":tada: Guild %GUILD% is now premium!", nowPremium: ":tada: Guild %GUILD% is now premium!",
onlyDev: emojis.redx + "This command is only available for the bots owner!",
paused: emojis.pause + "Paused the music!", paused: emojis.pause + "Paused the music!",
permission: "🔒 Permission requirement:", permission: "🔒 Permission requirement:",
permissionsFalse: emojis.redx + "That value is already `false`!", permissionsFalse: emojis.redx + "That value is already `false`!",
@ -195,4 +194,4 @@ module.exports = {
videoUnavailable: emojis.redx + "That video is unavaiable! Please try again.", videoUnavailable: emojis.redx + "That video is unavaiable! Please try again.",
wrongVoiceChannel: emojis.redx + wrongVoiceChannel: emojis.redx +
"I'm sorry but you need to be in the same voice channel as Musix to use this command!", "I'm sorry but you need to be in the same voice channel as Musix to use this command!",
}; };

View File

@ -1,9 +1,8 @@
module.exports = function (client) { module.exports = function (client) {
const Discord = require('discord.js');
client.on('ready', () => { client.on('ready', () => {
require(`./ready.js`).execute(client, Discord); require(`./ready.js`).execute(client);
}).on('message', (msg) => { }).on('message', (msg) => {
require(`./msg.js`).execute(client, msg, Discord); require(`./msg.js`).execute(client, msg);
}).on('guildCreate', (guild) => { }).on('guildCreate', (guild) => {
require(`./guildCreate.js`).execute(client, guild); require(`./guildCreate.js`).execute(client, guild);
}) })
@ -34,4 +33,4 @@ module.exports = function (client) {
client.logs.push(`Warn! info: ${info}`); client.logs.push(`Warn! info: ${info}`);
console.log(`Warn! info: ${info}`); console.log(`Warn! info: ${info}`);
}); });
} }

View File

@ -27,7 +27,7 @@ module.exports = {
}, },
}; };
function getCommand(client, args, msg, Discord) { function getCommand(client, args, msg) {
if (!args[0]) return; if (!args[0]) return;
const commandName = args[0].toLowerCase(); const commandName = args[0].toLowerCase();
if (commandName === "none") return; if (commandName === "none") return;
@ -37,8 +37,5 @@ function getCommand(client, args, msg, Discord) {
(cmd) => cmd.alias && cmd.alias.includes(commandName) (cmd) => cmd.alias && cmd.alias.includes(commandName)
); );
if (!command) return; if (!command) return;
if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send(client.messages.onlyDev); client.funcs.exe(msg, args, client, command);
if (client.config.devMode && msg.member.id !== client.config.devId && msg.guild.id !== "718081535240306738")
return msg.channel.send(client.messages.devMode);
client.funcs.exe(msg, args, client, Discord, command);
} }

View File

@ -29,7 +29,6 @@ module.exports = {
client.user.setActivity(`@${client.user.username} help | 🎶`, { client.user.setActivity(`@${client.user.username} help | 🎶`, {
type: "LISTENING", type: "LISTENING",
}); });
if (client.config.api && !client.config.devMode) client.funcs.botListApi(client);
client.user.setStatus("online"); client.user.setStatus("online");
client.funcs.getSpotifyKey(client); client.funcs.getSpotifyKey(client);
console.log(`- Activated - Shard: ${client.shard.ids} -`); console.log(`- Activated - Shard: ${client.shard.ids} -`);
@ -42,8 +41,5 @@ module.exports = {
setInterval(() => { setInterval(() => {
client.funcs.getSpotifyKey(client); client.funcs.getSpotifyKey(client);
}, 3600000); }, 3600000);
setInterval(() => {
client.funcs.ffmpeg(client, Discord);
}, 7200000);
}, },
}; };

View File

@ -1,6 +1,5 @@
const similarSongs = require("similar-songs"); const similarSongs = require("similar-songs");
const ytdl = require("ytdl-core"); const ytdl = require("ytdl-core");
const Discord = require("discord.js");
module.exports = { module.exports = {
async execute(client, guild) { async execute(client, guild) {
@ -48,7 +47,7 @@ function findSimilar(client, queue, prevSongs, guild) {
limit: 10, limit: 10,
lastfmAPIKey: client.config.lastfm_api_key, lastfmAPIKey: client.config.lastfm_api_key,
lastfmAPISecret: client.config.lastfm_secret, lastfmAPISecret: client.config.lastfm_secret,
youtubeAPIKey: client.config.api_keys[(client.shard.ids / 2).toFixed() || client.config.api_key], youtubeAPIKey: client.config.youtube_api_key,
}, },
async function (err, songs) { async function (err, songs) {
if (err) { if (err) {
@ -74,7 +73,7 @@ function findSimilar(client, queue, prevSongs, guild) {
`https://www.youtube.com/watch?v=${songs[random].youtubeId}` `https://www.youtube.com/watch?v=${songs[random].youtubeId}`
); );
queue.songs.push({ queue.songs.push({
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title), title: songInfo.videoDetails.title,
url: `https://www.youtube.com/watch?v=${songs[random].youtubeId}`, url: `https://www.youtube.com/watch?v=${songs[random].youtubeId}`,
author: client.user, author: client.user,
type: "ytdl", type: "ytdl",
@ -93,4 +92,4 @@ function findSimilar(client, queue, prevSongs, guild) {
} }
} }
); );
} }

View File

@ -31,4 +31,4 @@ module.exports = function (client, msg, command) {
} else return true; } else return true;
} else return true; } else return true;
} else return true; } else return true;
}; };

View File

@ -1,4 +1,4 @@
module.exports = function (msg, args, client, Discord, command) { module.exports = function (msg, args, client, command) {
const permissions = msg.channel.permissionsFor(client.user); const permissions = msg.channel.permissionsFor(client.user);
if (!permissions.has("EMBED_LINKS")) if (!permissions.has("EMBED_LINKS"))
return msg.channel.send(client.messages.noPermsEmbed); return msg.channel.send(client.messages.noPermsEmbed);
@ -11,10 +11,10 @@ module.exports = function (msg, args, client, Discord, command) {
return msg.channel.send(client.messages.musicCommandsDisabled); return msg.channel.send(client.messages.musicCommandsDisabled);
try { try {
command.uses++; command.uses++;
command.execute(msg, args, client, Discord, command); command.execute(msg, args, client, command);
} catch (error) { } catch (error) {
msg.reply(client.messages.errorExe); msg.reply(client.messages.errorExe);
console.log(error.toString()); console.log(error.toString());
console.log(error.stack.replace(/at /g, "**at **")); console.log(error.stack.replace(/at /g, "**at **"));
} }
}; };

View File

@ -1,4 +1,3 @@
const Discord = require("discord.js");
const ytdl = require("ytdl-core"); const ytdl = require("ytdl-core");
module.exports = async function ( module.exports = async function (
@ -12,7 +11,7 @@ module.exports = async function (
) { ) {
const songInfo = await ytdl.getInfo(resource).catch(err => console.log(err)); const songInfo = await ytdl.getInfo(resource).catch(err => console.log(err));
const song = { const song = {
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title), title: songInfo.videoDetails.title,
url: resource, url: resource,
author: msg.author, author: msg.author,
type: type, type: type,
@ -67,4 +66,4 @@ module.exports = async function (
return msg.channel.send(client.messages.error + error); return msg.channel.send(client.messages.error + error);
} }
return; return;
}; };

View File

@ -1,12 +1,12 @@
const { const {
Readable: ReadableStream Readable: ReadableStream
} = require("stream"); } = require("stream");
const Discord = require("discord.js");
const ytdl = require("ytdl-core"); const ytdl = require("ytdl-core");
const { const {
streamConfig streamConfig
} = require("../config/config.js"); } = require("../config/config.js");
const prism = require("prism-media"); const prism = require("prism-media");
const { EmbedBuilder } = require("discord.js");
module.exports = async function (guild, song, client, seek, play) { module.exports = async function (guild, song, client, seek, play) {
const queue = client.queue.get(guild.id); const queue = client.queue.get(guild.id);
@ -75,11 +75,11 @@ module.exports = async function (guild, song, client, seek, play) {
dispatcher.setVolume(queue.volume / 100); dispatcher.setVolume(queue.volume / 100);
require("../../events/dispatcherEvents/handler")(client, dispatcher, queue, guild); require("../events/dispatcherEvents/handler")(client, dispatcher, queue, guild);
if ((client.global.db.guilds[guild.id].startPlaying && play) || play) { if ((client.global.db.guilds[guild.id].startPlaying && play) || play) {
if (song.type !== "ytdl" && song.type !== "spotify") return; if (song.type !== "ytdl" && song.type !== "spotify") return;
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(`${client.messages.startPlaying}**${song.title}**`) .setTitle(`${client.messages.startPlaying}**${song.title}**`)
.setDescription( .setDescription(
`Song duration: \`${client.funcs.msToTime( `Song duration: \`${client.funcs.msToTime(
@ -91,4 +91,4 @@ module.exports = async function (guild, song, client, seek, play) {
queue.textChannel.send(embed); queue.textChannel.send(embed);
} }
queue.playing = true; queue.playing = true;
}; };

View File

@ -1,12 +0,0 @@
{
"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

@ -1,38 +0,0 @@
module.exports = function (client) {
const DBL = require("dblapi.js");
const dbl = new DBL(client.config.dblKey, client);
const bod_api = require("bodapi.js");
const bod = new bod_api(client.config.bodKey, client);
let guildCount;
client.shard
.broadcastEval("this.guilds.cache.size")
.then((results) => {
guildCount = results.reduce((prev, val) => prev + val, 0);
dbl.postStats(1, client.shard.ids, client.config.shards);
bod.postStats(1, client.shard.ids, client.config.shards);
})
.catch(console.error);
dbl.on("error", (e) => {
console.log(`DBL error: ${e}`);
});
bod.on("error", (e) => {
console.log(`BOD error ${e}`);
});
/*const authOptions = {
url: "https://discord.bots.gg/bots/607266889537945605/stats",
headers: {
Host: "https://discord.bots.gg/api/v1",
Authorization: client.config.botListKey,
Content - Type: "application/json",
{
"guildCount": 10
}
}
}*/
setInterval(() => {
/*dbl.postStats(guildCount * 7, client.shard.ids, client.config.shards);
bod.postStats(guildCount * 7, client.shard.ids, client.config.shards)*/
}, 1800000);
};

View File

@ -1,9 +0,0 @@
module.exports = async function (client) {
if (!client.guilds.cache.has(client.config.testServer)) return;
try {
await client.channels.fetch(client.config.secondary_test_channel)
.then(x => x.join());
} catch (error) {
console.log(error);
}
};