mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-22 05:23:47 +00:00
Fix code to work on this decade 1/x
This commit is contained in:
parent
99ecd9787d
commit
86b4676159
16
README.md
16
README.md
@ -1,15 +1 @@
|
||||
# Musix-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!
|
||||
# Musix OSS - V3
|
||||
|
15
index.js
15
index.js
@ -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");
|
||||
|
||||
if (config.devMode) {
|
||||
console.log("- dev mode- ");
|
||||
config.token = config.devToken;
|
||||
config.shards = 1;
|
||||
}
|
||||
|
||||
const {
|
||||
ShardingManager
|
||||
} = require("discord.js");
|
||||
const manager = new ShardingManager("./src/bot.js", {
|
||||
token: config.token,
|
||||
respawn: config.respawn,
|
||||
@ -22,19 +19,13 @@ manager.on("shardCreate", (shard) =>
|
||||
console.log(`- Launched shard ${shard.id} -`)
|
||||
);
|
||||
|
||||
const webhookClient = new DiscordWebhook.Webhook(config.webhookUrl);
|
||||
|
||||
const oldConsole = {};
|
||||
oldConsole.log = console.log;
|
||||
console.log = function (arg) {
|
||||
oldConsole.log(arg);
|
||||
if (!config.devMode && arg)
|
||||
webhookClient.send(JSON.stringify(arg));
|
||||
};
|
||||
|
||||
oldConsole.error = console.error;
|
||||
console.error = function (arg) {
|
||||
oldConsole.error(arg);
|
||||
if (!config.devMode && arg)
|
||||
webhookClient.send(JSON.stringify(arg));
|
||||
};
|
||||
};
|
||||
|
3690
package-lock.json
generated
Normal file
3690
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@ -1,51 +1,39 @@
|
||||
{
|
||||
"name": "musix",
|
||||
"version": "3.10.2",
|
||||
"name": "musix-oss",
|
||||
"version": "3.11.0",
|
||||
"description": "V3 for Musix the discord music bot",
|
||||
"main": "./index.js",
|
||||
"scripts": {
|
||||
"start": "node --max-old-space-size=3072 index.js"
|
||||
"start": "node --max-old-space-size=3072 index.js",
|
||||
"start:dev": "nodemon"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MatteZ02/Musix-V3.git"
|
||||
"url": "git+https://github.com/musix-org/musix-oss.git"
|
||||
},
|
||||
"author": "Matte",
|
||||
"license": "ISC",
|
||||
"author": "Musix Org",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/MatteZ02/Musix-V3/issues",
|
||||
"url": "https://github.com/musix-org/musix-oss/issues",
|
||||
"support": "https://discord.gg/rvHuJtB"
|
||||
},
|
||||
"homepage": "https://musix-web.herokuapp.com/",
|
||||
"homepage": "https://musix-org.github.io/",
|
||||
"dependencies": {
|
||||
"@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.js": "^14.14.1",
|
||||
"dotenv": "^16.4.1",
|
||||
"erlpack": "github:discordapp/erlpack",
|
||||
"express": "^4.17.1",
|
||||
"firebase": "^10.8.0",
|
||||
"firebase-admin": "^12.0.0",
|
||||
"fs": "0.0.1-security",
|
||||
"genius-lyrics-api": "^3.2.0",
|
||||
"he": "^1.2.0",
|
||||
"libsodium-wrappers": "^0.7.6",
|
||||
"ms": "^2.1.2",
|
||||
"node-spotify-api": "^1.1.1",
|
||||
"prism-media": "github:hydrabolt/prism-media",
|
||||
"prism-media": "^1.3.5",
|
||||
"request": "^2.88.2",
|
||||
"similar-songs": "^0.1.3",
|
||||
"simple-youtube-api": "^5.2.1",
|
||||
"soundcloud-api-client": "0.0.9",
|
||||
"spotify-web-api-node": "^5.0.2",
|
||||
"utf-8-validate": "^6.0.3",
|
||||
"ytdl-core": "^4.11.5",
|
||||
"ytsr": "^3.8.4",
|
||||
"zlib-sync": "^0.1.7"
|
||||
"ytsr": "^3.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.0.3"
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,14 @@
|
||||
const MusicClient = require("./struct/client.js");
|
||||
const MusicClient = require("./client.js");
|
||||
const DiscordWebhook = require("discord-webhook-node");
|
||||
const client = new MusicClient({});
|
||||
const webhookClient = new DiscordWebhook.Webhook(client.config.webhookUrl);
|
||||
|
||||
const oldConsole = {};
|
||||
oldConsole.log = console.log;
|
||||
console.log = function (arg) {
|
||||
oldConsole.log(arg);
|
||||
if (!client.config.devMode && arg)
|
||||
webhookClient.send(JSON.stringify(arg));
|
||||
};
|
||||
|
||||
oldConsole.error = console.error;
|
||||
console.error = function (arg) {
|
||||
oldConsole.error(arg);
|
||||
if (!client.config.devMode && arg)
|
||||
webhookClient.send(JSON.stringify(arg));
|
||||
};
|
||||
};
|
||||
|
@ -15,13 +15,14 @@ const GatewayIntents = new Intents();
|
||||
GatewayIntents.add(
|
||||
1 << 0, // GUILDS
|
||||
1 << 7, // GUILD_VOICE_STATES
|
||||
1 << 9, // GUILD_MESSAGES
|
||||
1 << 9, // GUILD_MESSAGES,
|
||||
1 << 15 // MESSAGE_CONTENT
|
||||
);
|
||||
|
||||
module.exports = class extends Client {
|
||||
constructor() {
|
||||
super({
|
||||
disableEveryone: true,
|
||||
disableMentions: "everyone",
|
||||
disabledEvents: ["TYPING_START"],
|
||||
ws: {
|
||||
intents: GatewayIntents
|
||||
@ -38,7 +39,7 @@ module.exports = class extends Client {
|
||||
id: config.spotify_client_id,
|
||||
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.funcs = {};
|
||||
this.dispatcher = {};
|
||||
@ -48,7 +49,7 @@ module.exports = class extends Client {
|
||||
this.global = {
|
||||
db: {
|
||||
guilds: {},
|
||||
},
|
||||
}
|
||||
};
|
||||
this.logs = [];
|
||||
|
||||
@ -71,14 +72,11 @@ module.exports = class extends Client {
|
||||
const option = require(`../commands/settings/${file}`);
|
||||
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)
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
description: "Boost the bass in your music!",
|
||||
alias: ["none"],
|
||||
usage: "<bass>",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_MESSAGES",
|
||||
category: "audio modifiers",
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (!args[1] && queue)
|
||||
return msg.channel.send(
|
||||
@ -31,4 +30,4 @@ module.exports = {
|
||||
return msg.channel.send(message);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -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);
|
||||
},
|
||||
};
|
@ -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);
|
||||
},
|
||||
};
|
@ -1,19 +1,20 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
alias: ["h"],
|
||||
usage: '<command(opt)>',
|
||||
description: 'See the help for Musix.',
|
||||
onlyDev: false,
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
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');
|
||||
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}`)
|
||||
.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)
|
||||
msg.channel.send(embed);
|
||||
} else {
|
||||
@ -23,16 +24,16 @@ module.exports = {
|
||||
}
|
||||
let commands = '';
|
||||
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;
|
||||
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}`)
|
||||
.setDescription(commands)
|
||||
.setFooter(message)
|
||||
.setFooter({ text: message })
|
||||
.setColor(client.config.embedColor)
|
||||
msg.channel.send(embed);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,16 +1,17 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'invite',
|
||||
alias: ["i"],
|
||||
usage: '',
|
||||
description: 'Invite Musix.',
|
||||
onlyDev: false,
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
execute(msg, args, client, command) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.inviteTitle)
|
||||
.setURL(client.config.invite)
|
||||
.setColor(client.config.embedColor)
|
||||
msg.channel.send(embed);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: [],
|
||||
usage: '',
|
||||
description: 'loop the queue.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (!queue.looping) {
|
||||
@ -18,4 +17,4 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["none"],
|
||||
usage: '',
|
||||
description: 'loop the currently playing song.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (!queue.songLooping) {
|
||||
@ -20,4 +19,4 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
const { getLyrics } = require("genius-lyrics-api");
|
||||
|
||||
module.exports = {
|
||||
@ -5,10 +6,9 @@ module.exports = {
|
||||
alias: ["l"],
|
||||
usage: "<song>",
|
||||
description: "see the lyrics for a song",
|
||||
onlyDev: false,
|
||||
permission: "none",
|
||||
category: "util",
|
||||
async execute(msg, args, client, Discord, prefix, command) {
|
||||
async execute(msg, args, client, prefix, command) {
|
||||
const searchString = args.slice(1).join(" ");
|
||||
const options = {
|
||||
apiKey: client.config.genius_api_key,
|
||||
@ -26,7 +26,7 @@ module.exports = {
|
||||
for (let i = 0; i < lyrics.length; i += 2000) {
|
||||
let toi = "";
|
||||
toi = lyrics.substring(i, Math.min(lyrics.length, i + 2000));
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.lyricsTitle)
|
||||
.setDescription(toi)
|
||||
.setColor(client.config.embedColor);
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["nc"],
|
||||
usage: "<true/false>",
|
||||
description: "Change nightcore audio modifier on/off",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_MESSAGES",
|
||||
category: "audio modifiers",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (!args[1] && queue)
|
||||
return msg.channel.send(
|
||||
@ -23,4 +22,4 @@ module.exports = {
|
||||
return msg.channel.send(message);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -1,12 +1,13 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: "nowplaying",
|
||||
alias: ["np", "playing"],
|
||||
usage: "",
|
||||
description: "See the currently playing song position and length.",
|
||||
onlyDev: false,
|
||||
permission: "none",
|
||||
category: "info",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
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);
|
||||
let songTime = (queue.songs[0].info.lengthSeconds * 1000).toFixed(0);
|
||||
@ -24,7 +25,7 @@ module.exports = {
|
||||
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 embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.nowPlaying)
|
||||
.setDescription(
|
||||
`${client.messages.nowPlayingDesc} ${
|
||||
@ -34,7 +35,7 @@ module.exports = {
|
||||
"hh:mm:ss"
|
||||
)} / ${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)
|
||||
.setThumbnail(thumbnail.url)
|
||||
.setColor(client.config.embedColor);
|
||||
@ -44,4 +45,4 @@ module.exports = {
|
||||
);
|
||||
return msg.channel.send(embed);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["none"],
|
||||
usage: '',
|
||||
description: 'Pause the currently playing music.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (queue.paused) return msg.channel.send(client.messages.alreadyPaused);
|
||||
@ -15,4 +14,4 @@ module.exports = {
|
||||
return msg.channel.send(client.messages.paused);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -6,10 +6,9 @@ module.exports = {
|
||||
alias: ["p", "music"],
|
||||
usage: "<song name>",
|
||||
description: "Play some music.",
|
||||
onlyDev: false,
|
||||
permission: "none",
|
||||
category: "play",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const searchString = args.slice(1).join(" ");
|
||||
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
@ -399,4 +398,4 @@ async function searchSong(data, client, msg, voiceChannel) {
|
||||
)}\n${client.messages.failedToLoad + failed}`;
|
||||
}
|
||||
lmsg.edit(message);
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["prev", "return", "back"],
|
||||
usage: '',
|
||||
description: 'Play the previous song.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id)
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (queue.prevSongs.length < 1) return msg.channel.send(client.messages.noPreviousSongs);
|
||||
@ -15,4 +14,4 @@ module.exports = {
|
||||
msg.channel.send(client.messages.previousSong)
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,12 +1,13 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'queue',
|
||||
alias: ["q", "list", "ls", "songs"],
|
||||
usage: '',
|
||||
description: 'See the queue.',
|
||||
onlyDev: false,
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (!queue) return msg.channel.send(client.messages.noServerQueue);
|
||||
const page = 1;
|
||||
@ -18,11 +19,11 @@ module.exports = {
|
||||
}
|
||||
let message;
|
||||
message = client.messages.queueDesc.replace("%SONG%", queue.songs[0].title);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.queueTitle)
|
||||
.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)
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["rm", "delete", "del"],
|
||||
usage: "<song pos>",
|
||||
description: "Remove a song from the queue",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_MESSAGES",
|
||||
category: "music control",
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (!args[1]) return msg.channel.send(client.messages.provideASong);
|
||||
@ -29,4 +28,4 @@ module.exports = {
|
||||
return queue.songs.splice(pos, 1);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -3,14 +3,13 @@ module.exports = {
|
||||
alias: ["rp"],
|
||||
usage: '',
|
||||
description: 'Replay the currently playing song.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'play',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
queue.endReason = "replay";
|
||||
queue.connection.dispatcher.end()
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["continue"],
|
||||
usage: '',
|
||||
description: 'Resume the paused music.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (!queue.paused) return msg.channel.send(client.messages.notPaused);
|
||||
@ -15,4 +14,4 @@ module.exports = {
|
||||
return msg.channel.send(client.messages.resumed);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
@ -1,15 +1,15 @@
|
||||
const ytsr = require('ytsr');
|
||||
const he = require('he');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'search',
|
||||
alias: ["sr", "find"],
|
||||
usage: '<search word(s)>',
|
||||
description: 'Search the top 10 queryes and choose one.',
|
||||
onlyDev: false,
|
||||
permission: 'none',
|
||||
category: 'play',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const searchString = args.slice(1).join(" ");
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
@ -30,10 +30,10 @@ module.exports = {
|
||||
const videoResults = res.items.filter(item => item.type === "video");
|
||||
const videos = videoResults.slice(0, 10);
|
||||
let index = 0;
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.songSelection)
|
||||
.setDescription(`${videos.map(video2 => `**${++index}** ${he.decode(video2.title)} `).join('\n')}`)
|
||||
.setFooter(client.messages.provideANumber)
|
||||
.setFooter({ text: client.messages.provideANumber })
|
||||
.setColor(client.config.embedColor)
|
||||
msg.channel.send(embed);
|
||||
try {
|
||||
@ -58,4 +58,4 @@ module.exports = {
|
||||
});
|
||||
})
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["none"],
|
||||
usage: "<point in song (seconds)>",
|
||||
description: "Seek to a specific point in the currently playing song.",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_MESSAGES",
|
||||
category: "music control",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (queue.nightCore)
|
||||
|
@ -1,60 +1,32 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: "settings",
|
||||
alias: ["options", "ops", "preferences"],
|
||||
usage: "<setting> <value(opt)>",
|
||||
description: "Change the server settings for Musix.",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_GUILD",
|
||||
category: "util",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
let footer;
|
||||
footer = client.messages.settingsFooter.replace(
|
||||
"%PREFIX%",
|
||||
client.global.db.guilds[msg.guild.id].prefix
|
||||
);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.settingsTitle)
|
||||
.addField(
|
||||
client.messages.settingsPrefix,
|
||||
client.messages.settingsPrefixDesc,
|
||||
true
|
||||
.addFields(
|
||||
{ name: client.messages.settingsPrefix, value: client.messages.settingsPrefixDesc, inline: true },
|
||||
{ name: client.messages.settingsVolume, value: client.messages.settingsVolumeDesc, inline: 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(
|
||||
client.messages.settingsVolume,
|
||||
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)
|
||||
.setFooter({ text: footer })
|
||||
.setAuthor({ name: client.user.username, iconURL: client.user.avatarURL() })
|
||||
.setColor(client.config.embedColor);
|
||||
const permissions = msg.channel.permissionsFor(msg.author);
|
||||
if (msg.author.id !== client.config.devId) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const discord = require("discord.js");
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: "blacklist",
|
||||
@ -89,7 +89,7 @@ module.exports = {
|
||||
}
|
||||
break;
|
||||
case "list":
|
||||
embed = new discord.MessageEmbed()
|
||||
embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.blacklistTitle)
|
||||
.setDescription(
|
||||
`${client.global.db.guilds[msg.guild.id].blacklist
|
||||
@ -100,17 +100,16 @@ module.exports = {
|
||||
msg.channel.send(embed);
|
||||
break;
|
||||
case undefined:
|
||||
embed = new discord.MessageEmbed()
|
||||
embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.blacklistTitle)
|
||||
.addField("add", "Add a channel to the blacklist. (ID or mention)")
|
||||
.addField(
|
||||
"remove",
|
||||
"Remove a channel from the blacklist. (ID or mention)"
|
||||
.addFields(
|
||||
{ name: "add", value: "Add a channel to the blacklist. (ID or mention)" },
|
||||
{ name: "remove", value: "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);
|
||||
msg.channel.send(embed);
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -6,8 +6,6 @@ module.exports = {
|
||||
client.messages.premiumState +
|
||||
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) {
|
||||
client.global.db.guilds[args[2]].premium = true;
|
||||
let message;
|
||||
|
@ -3,14 +3,13 @@ module.exports = {
|
||||
alias: ["none"],
|
||||
usage: '',
|
||||
description: 'Shuffle the queue.',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
client.funcs.shuffle(queue.songs);
|
||||
msg.channel.send(client.messages.shuffled);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["s", "next"],
|
||||
usage: "",
|
||||
description: "Skip the currently playing song.",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_MESSAGES",
|
||||
category: "music control",
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
const permissions = msg.channel.permissionsFor(msg.author);
|
||||
if (!queue || !queue.playing)
|
||||
@ -61,4 +60,4 @@ function vote(queue, msg, client) {
|
||||
} else {
|
||||
return skipSong(queue, msg, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
alias: ["st"],
|
||||
usage: "<point in queue>",
|
||||
description: "Skip to a point in the queue",
|
||||
onlyDev: false,
|
||||
permission: "MANAGE_MESSAGES",
|
||||
category: "music control",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (!args[1])
|
||||
@ -28,4 +27,4 @@ module.exports = {
|
||||
queue.connection.dispatcher.end();
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -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));
|
||||
},
|
||||
};
|
@ -1,26 +1,29 @@
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'status',
|
||||
alias: ["stats", "info"],
|
||||
usage: '',
|
||||
description: 'See the current status for Musix.',
|
||||
onlyDev: false,
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, 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()
|
||||
const embed = new EmbedBuilder()
|
||||
.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)
|
||||
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
||||
.addFields(
|
||||
{ name: client.messages.statusField1, value: client.ws.ping, inline: true },
|
||||
{ name: client.messages.statusField2, value: latency, inline: true },
|
||||
{ name: client.messages.statusField3, value: uptime, inline: true },
|
||||
{ name: client.messages.statusField4, value: client.shard.ids },
|
||||
)
|
||||
.setAuthor({ name: client.user.username, iconURL: client.user.avatarURL() })
|
||||
.setColor(client.config.embedColor)
|
||||
m.delete();
|
||||
return msg.channel.send(embed);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -3,10 +3,9 @@ module.exports = {
|
||||
description: 'Stop the music and clear the queue.',
|
||||
alias: ["none"],
|
||||
usage: '',
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_CHANNELS',
|
||||
category: 'music control',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (msg.content.includes("-force")) {
|
||||
@ -28,4 +27,4 @@ module.exports = {
|
||||
msg.channel.send(client.messages.stop);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
};
|
@ -4,10 +4,9 @@ module.exports = {
|
||||
alias: ["none"],
|
||||
usage: '<volume>',
|
||||
cooldown: 5,
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music control',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(msg, args, client, command) {
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
if (!args[1] && queue) return msg.channel.send(`${client.messages.currentVolume}**${queue.volume}**`);
|
||||
const volume = parseFloat(args[1]);
|
||||
@ -20,4 +19,4 @@ module.exports = {
|
||||
return msg.channel.send(`${client.messages.setVolume}**${volume}**`);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,21 +1,17 @@
|
||||
require("dotenv/config");
|
||||
|
||||
module.exports = {
|
||||
token: process.env.TOKEN,
|
||||
devToken: process.env.DEVTOKEN,
|
||||
dblKey: process.env.DBLKEY,
|
||||
discord_api_token: process.env.DISCORD_API_TOKEN,
|
||||
bodKey: process.env.BODKEY,
|
||||
api_key: process.env.GOOGLE_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],
|
||||
youtube_api_key: process.env.YOUTUBE_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_client_secret: process.env.SPOTIFY_CLIENT_SECRET,
|
||||
spotify_client_id: process.env.SPOTIFY_CLIENT_ID,
|
||||
spotify_refresh_token: process.env.SPOTIFY_REFRESH_TOKEN,
|
||||
lastfm_api_key: process.env.LASTFM_API_KEY,
|
||||
lastfm_secret: process.env.LASTFM_SECRET,
|
||||
webhookUrl: process.env.WEBHOOK_URL,
|
||||
port: 8888,
|
||||
redirectUri: "http://localhost:8888/callback/",
|
||||
testServer: "489111553321336832",
|
||||
@ -100,4 +96,4 @@ module.exports.emojis = {
|
||||
stop: "<:stop:674685626108477519> ",
|
||||
stopWatch: ":stopwatch: ",
|
||||
volumeHigh: "<:volumehigh:674685637626167307> ",
|
||||
};
|
||||
};
|
@ -122,7 +122,6 @@ module.exports = {
|
||||
"I'm sorry but you need to be in a voice channel to play music!",
|
||||
nowPlaying: "__Now playing__",
|
||||
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!",
|
||||
permission: "🔒 Permission requirement:",
|
||||
permissionsFalse: emojis.redx + "That value is already `false`!",
|
||||
@ -195,4 +194,4 @@ module.exports = {
|
||||
videoUnavailable: emojis.redx + "That video is unavaiable! Please try again.",
|
||||
wrongVoiceChannel: emojis.redx +
|
||||
"I'm sorry but you need to be in the same voice channel as Musix to use this command!",
|
||||
};
|
||||
};
|
@ -1,9 +1,8 @@
|
||||
module.exports = function (client) {
|
||||
const Discord = require('discord.js');
|
||||
client.on('ready', () => {
|
||||
require(`./ready.js`).execute(client, Discord);
|
||||
require(`./ready.js`).execute(client);
|
||||
}).on('message', (msg) => {
|
||||
require(`./msg.js`).execute(client, msg, Discord);
|
||||
require(`./msg.js`).execute(client, msg);
|
||||
}).on('guildCreate', (guild) => {
|
||||
require(`./guildCreate.js`).execute(client, guild);
|
||||
})
|
||||
@ -34,4 +33,4 @@ module.exports = function (client) {
|
||||
client.logs.push(`Warn! info: ${info}`);
|
||||
console.log(`Warn! info: ${info}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ module.exports = {
|
||||
},
|
||||
};
|
||||
|
||||
function getCommand(client, args, msg, Discord) {
|
||||
function getCommand(client, args, msg) {
|
||||
if (!args[0]) return;
|
||||
const commandName = args[0].toLowerCase();
|
||||
if (commandName === "none") return;
|
||||
@ -37,8 +37,5 @@ function getCommand(client, args, msg, Discord) {
|
||||
(cmd) => cmd.alias && cmd.alias.includes(commandName)
|
||||
);
|
||||
if (!command) return;
|
||||
if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send(client.messages.onlyDev);
|
||||
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);
|
||||
client.funcs.exe(msg, args, client, command);
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ module.exports = {
|
||||
client.user.setActivity(`@${client.user.username} help | 🎶`, {
|
||||
type: "LISTENING",
|
||||
});
|
||||
if (client.config.api && !client.config.devMode) client.funcs.botListApi(client);
|
||||
client.user.setStatus("online");
|
||||
client.funcs.getSpotifyKey(client);
|
||||
console.log(`- Activated - Shard: ${client.shard.ids} -`);
|
||||
@ -42,8 +41,5 @@ module.exports = {
|
||||
setInterval(() => {
|
||||
client.funcs.getSpotifyKey(client);
|
||||
}, 3600000);
|
||||
setInterval(() => {
|
||||
client.funcs.ffmpeg(client, Discord);
|
||||
}, 7200000);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
const similarSongs = require("similar-songs");
|
||||
const ytdl = require("ytdl-core");
|
||||
const Discord = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
async execute(client, guild) {
|
||||
@ -48,7 +47,7 @@ function findSimilar(client, queue, prevSongs, guild) {
|
||||
limit: 10,
|
||||
lastfmAPIKey: client.config.lastfm_api_key,
|
||||
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) {
|
||||
if (err) {
|
||||
@ -74,7 +73,7 @@ function findSimilar(client, queue, prevSongs, guild) {
|
||||
`https://www.youtube.com/watch?v=${songs[random].youtubeId}`
|
||||
);
|
||||
queue.songs.push({
|
||||
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title),
|
||||
title: songInfo.videoDetails.title,
|
||||
url: `https://www.youtube.com/watch?v=${songs[random].youtubeId}`,
|
||||
author: client.user,
|
||||
type: "ytdl",
|
||||
@ -93,4 +92,4 @@ function findSimilar(client, queue, prevSongs, guild) {
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,4 @@ module.exports = function (client, msg, command) {
|
||||
} else return true;
|
||||
} else return true;
|
||||
} else return true;
|
||||
};
|
||||
};
|
@ -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);
|
||||
if (!permissions.has("EMBED_LINKS"))
|
||||
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);
|
||||
try {
|
||||
command.uses++;
|
||||
command.execute(msg, args, client, Discord, command);
|
||||
command.execute(msg, args, client, command);
|
||||
} catch (error) {
|
||||
msg.reply(client.messages.errorExe);
|
||||
console.log(error.toString());
|
||||
console.log(error.stack.replace(/at /g, "**at **"));
|
||||
}
|
||||
};
|
||||
};
|
@ -1,4 +1,3 @@
|
||||
const Discord = require("discord.js");
|
||||
const ytdl = require("ytdl-core");
|
||||
|
||||
module.exports = async function (
|
||||
@ -12,7 +11,7 @@ module.exports = async function (
|
||||
) {
|
||||
const songInfo = await ytdl.getInfo(resource).catch(err => console.log(err));
|
||||
const song = {
|
||||
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title),
|
||||
title: songInfo.videoDetails.title,
|
||||
url: resource,
|
||||
author: msg.author,
|
||||
type: type,
|
||||
@ -67,4 +66,4 @@ module.exports = async function (
|
||||
return msg.channel.send(client.messages.error + error);
|
||||
}
|
||||
return;
|
||||
};
|
||||
};
|
@ -1,12 +1,12 @@
|
||||
const {
|
||||
Readable: ReadableStream
|
||||
} = require("stream");
|
||||
const Discord = require("discord.js");
|
||||
const ytdl = require("ytdl-core");
|
||||
const {
|
||||
streamConfig
|
||||
} = require("../config/config.js");
|
||||
const prism = require("prism-media");
|
||||
const { EmbedBuilder } = require("discord.js");
|
||||
|
||||
module.exports = async function (guild, song, client, seek, play) {
|
||||
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);
|
||||
|
||||
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 (song.type !== "ytdl" && song.type !== "spotify") return;
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${client.messages.startPlaying}**${song.title}**`)
|
||||
.setDescription(
|
||||
`Song duration: \`${client.funcs.msToTime(
|
||||
@ -91,4 +91,4 @@ module.exports = async function (guild, song, client, seek, play) {
|
||||
queue.textChannel.send(embed);
|
||||
}
|
||||
queue.playing = true;
|
||||
};
|
||||
};
|
@ -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"
|
||||
}
|
@ -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);
|
||||
};
|
@ -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);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user