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

Chore update 3.8

This commit is contained in:
MatteZ02 2020-07-04 22:17:20 +03:00
parent ba3d17bb2a
commit 5a77443df6
11 changed files with 66 additions and 74 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "musix", "name": "musix",
"version": "3.7.2", "version": "3.8.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": {

View File

@ -12,6 +12,5 @@ module.exports = {
.setURL(client.config.invite) .setURL(client.config.invite)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
msg.channel.send(embed); msg.channel.send(embed);
msg.channel.send(client.messages.joinSupport + client.config.supportServer);
} }
}; };

View File

@ -49,23 +49,24 @@ module.exports = {
const playlistId = url.split("/playlist/")[1].split("?")[0]; const playlistId = url.split("/playlist/")[1].split("?")[0];
spotify.getPlaylist(playlistId).then( spotify.getPlaylist(playlistId).then(
async function (data) { async function (data) {
searchPlaylist(data, client, msg, voiceChannel); console.log(data.body)
}, searchPlaylist(data, client, msg, voiceChannel);
function (err) { },
console.log(err); function (err) {
msg.channel.send(client.messages.noResultsSpotify); console.log(err);
} msg.channel.send(client.messages.noResultsSpotify);
}
); );
} else if (url.includes("album")) { } else if (url.includes("album")) {
const albumId = url.split("/album/")[1].split("?")[0]; const albumId = url.split("/album/")[1].split("?")[0];
spotify.getAlbumTracks(albumId).then( spotify.getAlbumTracks(albumId).then(
async function (data) { async function (data) {
searchAlbum(data, client, msg, voiceChannel); searchAlbum(data, client, msg, voiceChannel);
}, },
function (err) { function (err) {
console.log(err); console.log(err);
msg.channel.send(client.messages.noResultsSpotify); msg.channel.send(client.messages.noResultsSpotify);
} }
); );
} else if (url.includes("track")) { } else if (url.includes("track")) {
return msg.channel.send(client.messages.disabledSpotifySongs); return msg.channel.send(client.messages.disabledSpotifySongs);
@ -115,8 +116,7 @@ module.exports = {
return lmsg.edit(message); return lmsg.edit(message);
} else { } else {
ytsr( ytsr(
searchString, searchString, {
{
limit: 5, limit: 5,
}, },
function (err, res) { function (err, res) {
@ -154,24 +154,21 @@ async function searchPlaylist(data, client, msg, voiceChannel) {
const track = await data.body.tracks.items[i].track; const track = await data.body.tracks.items[i].track;
await client.funcs.sleep(250); await client.funcs.sleep(250);
ytsr( ytsr(
`${track.artists[0].name} ${track.name} audio`, `${track.artists[0].name} ${track.name} audio`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
if (err) return console.log(err); if (err) return console.log(err);
if (!res.items[0]) { if (!res.items[0]) {
ytsr( ytsr(
`${track.artists[0].name} ${track.name} lyrics`, `${track.artists[0].name} ${track.name} lyrics`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
if (err) return console.log(err); if (err) return console.log(err);
if (!res.items[0]) { if (!res.items[0]) {
ytsr( ytsr(
`${track.artists[0].name} ${track.name}`, `${track.artists[0].name} ${track.name}`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
@ -244,24 +241,21 @@ async function searchAlbum(data, client, msg, voiceChannel) {
const track = await data.body.items[i]; const track = await data.body.items[i];
await client.funcs.sleep(250); await client.funcs.sleep(250);
ytsr( ytsr(
`${track.artists[0].name} ${track.name} audio`, `${track.artists[0].name} ${track.name} audio`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
if (err) return console.log(err); if (err) return console.log(err);
if (!res.items[0]) { if (!res.items[0]) {
ytsr( ytsr(
`${track.artists[0].name} ${track.name} lyrics`, `${track.artists[0].name} ${track.name} lyrics`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
if (err) return console.log(err); if (err) return console.log(err);
if (!res.items[0]) { if (!res.items[0]) {
ytsr( ytsr(
`${track.artists[0].name} ${track.name}`, `${track.artists[0].name} ${track.name}`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
@ -337,24 +331,21 @@ async function searchSong(data, client, msg, voiceChannel) {
const track = await data.body.tracks.items[i].track; const track = await data.body.tracks.items[i].track;
await client.funcs.sleep(250); await client.funcs.sleep(250);
ytsr( ytsr(
`${track.artists[0].name} ${track.name} audio`, `${track.artists[0].name} ${track.name} audio`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
if (err) return console.log(err); if (err) return console.log(err);
if (!res.items[0]) { if (!res.items[0]) {
ytsr( ytsr(
`${track.artists[0].name} ${track.name} lyrics`, `${track.artists[0].name} ${track.name} lyrics`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
if (err) return console.log(err); if (err) return console.log(err);
if (!res.items[0]) { if (!res.items[0]) {
ytsr( ytsr(
`${track.artists[0].name} ${track.name}`, `${track.artists[0].name} ${track.name}`, {
{
limit: 5, limit: 5,
}, },
async function (err, res) { async function (err, res) {
@ -418,4 +409,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

@ -11,7 +11,7 @@ module.exports = {
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);
queue.paused = false; queue.paused = false;
queue.connection.dispatcher.resume(true); queue.connection.dispatcher.resume();
return msg.channel.send(client.messages.resumed); return msg.channel.send(client.messages.resumed);
} }
} }

View File

@ -15,7 +15,7 @@ module.exports = {
queue.exists = false; queue.exists = false;
} }
if (msg.guild.voice.channel) msg.guild.voice.channel.leave(); if (msg.guild.voice.channel) msg.guild.voice.channel.leave();
client.queue.delete(guild.id); client.queue.delete(msg.guild.id);
return msg.channel.send(client.messages.stop); return msg.channel.send(client.messages.stop);
} }
queue.songs = []; queue.songs = [];

View File

@ -1,34 +1,37 @@
module.exports = function (client) { module.exports = function (client) {
const Discord = require('discord.js'); const Discord = require('discord.js');
client.on('ready', () => { client.on('ready', () => {
require(`./ready.js`).execute(client, Discord); require(`./ready.js`).execute(client, Discord);
}).on('message', (msg) => { }).on('message', (msg) => {
require(`./msg.js`).execute(client, msg, Discord); require(`./msg.js`).execute(client, msg, Discord);
}).on('guildCreate', (guild) => { }).on('guildCreate', (guild) => {
require(`./guildCreate.js`).execute(client, guild); require(`./guildCreate.js`).execute(client, guild);
}).on('voiceStateUpdate', (oldState, newState) => { })
require(`./voiceStateUpdate.js`).execute(client, oldState, newState); .on('guildDelete', (guild) => {
}).on('error', (error) => { require(`./guildDelete.js`).execute(client, guild);
console.log(error); }).on('voiceStateUpdate', (oldState, newState) => {
}).on('debug', (info) => { require(`./voiceStateUpdate.js`).execute(client, oldState, newState);
if (client.config.devMode) console.log(info); }).on('error', (error) => {
}).on('invalidated', () => { console.log(error);
console.log("Client session invalidated! Exiting the process!") }).on('debug', (info) => {
process.exit(1); if (client.config.devMode) console.log(info);
}).on('rateLimit', (rateLimitInfo) => { }).on('invalidated', () => {
console.log("Client session invalidated! Exiting the process!")
process.exit(1);
}).on('rateLimit', (rateLimitInfo) => {
}).on('shardDisconnect', (event, id) => { }).on('shardDisconnect', (event, id) => {
client.logs.push(`Shard ${id} disconnected event ${event}`); client.logs.push(`Shard ${id} disconnected event ${event}`);
}).on('shardError', (error, shardId) => { }).on('shardError', (error, shardId) => {
client.logs.push(`Shard ${shardId} error ${error}`); client.logs.push(`Shard ${shardId} error ${error}`);
}).on('shardReady', (id, unavailableGuilds) => { }).on('shardReady', (id, unavailableGuilds) => {
client.logs.push(`Shard ${id} ready. Unavailable guilds: ${unavailableGuilds || 0}`); client.logs.push(`Shard ${id} ready. Unavailable guilds: ${unavailableGuilds || 0}`);
}).on('shardReconnecting', (id) => { }).on('shardReconnecting', (id) => {
client.logs.push(`shard ${id} reconnecting.`); client.logs.push(`shard ${id} reconnecting.`);
}).on('shardResume', (id, replayedEvents) => { }).on('shardResume', (id, replayedEvents) => {
client.logs.push(`shard ${id} resume events ${replayedEvents}`); client.logs.push(`shard ${id} resume events ${replayedEvents}`);
}).on("warn", (info) => { }).on("warn", (info) => {
client.logs.push(`Warn! info: ${info}`); client.logs.push(`Warn! info: ${info}`);
console.log(`Warn! info: ${info}`); console.log(`Warn! info: ${info}`);
}); });
} }

View File

@ -53,6 +53,7 @@ function findSimilar(client, queue, prevSongs, guild) {
youtubeAPIKey: client.config.api_key, youtubeAPIKey: client.config.api_key,
}, },
async function (err, songs) { async function (err, songs) {
console.log(songs)
if (err) { if (err) {
console.log(err.message); console.log(err.message);
return queue.textChannel.send(client.messages.error); return queue.textChannel.send(client.messages.error);

View File

@ -29,7 +29,6 @@ module.exports = class extends Client {
credential: admin.credential.cert(serviceAccount), credential: admin.credential.cert(serviceAccount),
}); });
this.commands = new Collection(); this.commands = new Collection();
this.commandAliases = new Collection();
this.settingCmd = new Collection(); this.settingCmd = new Collection();
this.queue = new Map(); this.queue = new Map();
this.funcs = {}; this.funcs = {};
@ -56,7 +55,6 @@ module.exports = class extends Client {
const command = require(`../commands/${file}`); const command = require(`../commands/${file}`);
command.uses = 0; command.uses = 0;
this.commands.set(command.name, command); this.commands.set(command.name, command);
this.commandAliases.set(command.alias, command);
} }
const settingFiles = fs const settingFiles = fs
.readdirSync(path.join(path.dirname(__dirname), "commands/settings")) .readdirSync(path.join(path.dirname(__dirname), "commands/settings"))

View File

@ -22,8 +22,8 @@ module.exports = {
secondary_test_channel: "570531724002328577", secondary_test_channel: "570531724002328577",
devId: "360363051792203779", devId: "360363051792203779",
embedColor: "#b50002", embedColor: "#b50002",
invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot", invite: "https://musix-web.herokuapp.com/releases",
supportServer: "https://discord.gg/rvHuJtB", supportServer: "https://musix-web.herokuapp.com/discord",
devMode: false, devMode: false,
api: false, api: false,
saveDB: true, saveDB: true,
@ -40,7 +40,7 @@ module.exports = {
djrole: null, djrole: null,
startPlaying: true, startPlaying: true,
bass: 1, bass: 1,
autoPlay: false, autoPlay: true,
}; };
module.exports.streamConfig = { module.exports.streamConfig = {
@ -99,4 +99,4 @@ module.exports.emojis = {
stop: "<:stop:674685626108477519> ", stop: "<:stop:674685626108477519> ",
stopWatch: ":stopwatch: ", stopWatch: ":stopwatch: ",
volumeHigh: "<:volumehigh:674685637626167307> ", volumeHigh: "<:volumehigh:674685637626167307> ",
}; };

View File

@ -69,7 +69,7 @@ module.exports = {
idOrMentionChannel: emojis.redx + "Please provide a channel id or mention a channel!", idOrMentionChannel: emojis.redx + "Please provide a channel id or mention a channel!",
invalidGuild: emojis.redx + "Invalid guild id!", invalidGuild: emojis.redx + "Invalid guild id!",
invalidSpotifyUrl: emojis.redx + "That url cannot be played! If you believe this is a mistake please contact support!", invalidSpotifyUrl: emojis.redx + "That url cannot be played! If you believe this is a mistake please contact support!",
inviteTitle: "Invite Musix to your Discord server!", inviteTitle: "Invite a release of Musix to your discord server!",
joined: emojis.green_check_mark + "Joined", joined: emojis.green_check_mark + "Joined",
joinSupport: "Join the musix support server: ", joinSupport: "Join the musix support server: ",
keySet: emojis.green_check_mark + "Key set!", keySet: emojis.green_check_mark + "Key set!",

View File

@ -3,7 +3,7 @@ module.exports = function (msg, args, client, Discord, command) {
if (!permissions.has("EMBED_LINKS")) if (!permissions.has("EMBED_LINKS"))
return msg.channel.send(client.messages.noPermsEmbed); return msg.channel.send(client.messages.noPermsEmbed);
if (!permissions.has("USE_EXTERNAL_EMOJIS")) if (!permissions.has("USE_EXTERNAL_EMOJIS"))
return msg.channel.send(client.noPermsUseExternalEmojis); return msg.channel.send(client.messages.noPermsUseExternalEmojis);
if ( if (
command.category === "music" && command.category === "music" &&
client.global.db.guilds[msg.guild.id].blacklist.includes(msg.channel.id) client.global.db.guilds[msg.guild.id].blacklist.includes(msg.channel.id)