mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 03:33:17 +00:00
fixes
This commit is contained in:
parent
2353262322
commit
3842f30bff
@ -53,7 +53,6 @@ module.exports = {
|
|||||||
client.messages.settingsAutoPlayDesc,
|
client.messages.settingsAutoPlayDesc,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.addField()
|
|
||||||
.setFooter(footer)
|
.setFooter(footer)
|
||||||
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
||||||
.setColor(client.config.embedColor);
|
.setColor(client.config.embedColor);
|
||||||
|
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
bass: client.config.bass,
|
bass: client.config.bass,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
premium: false,
|
premium: false,
|
||||||
playSimilar: client.config.playSimilar,
|
autoPlay: client.config.autoPlay,
|
||||||
};
|
};
|
||||||
msg.channel.send(client.messages.reset);
|
msg.channel.send(client.messages.reset);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
bass: client.config.bass,
|
bass: client.config.bass,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
premium: false,
|
premium: false,
|
||||||
playSimilar: client.config.playSimilar,
|
autoPlay: client.config.autoPlay,
|
||||||
});
|
});
|
||||||
client.global.db.guilds[guild.id] = {
|
client.global.db.guilds[guild.id] = {
|
||||||
prefix: client.config.prefix,
|
prefix: client.config.prefix,
|
||||||
@ -23,7 +23,7 @@ module.exports = {
|
|||||||
bass: client.config.bass,
|
bass: client.config.bass,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
premium: false,
|
premium: false,
|
||||||
playSimilar: client.config.playSimilar,
|
autoPlay: client.config.autoPlay,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -21,7 +21,7 @@ module.exports = {
|
|||||||
bass: client.config.bass,
|
bass: client.config.bass,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
premium: true,
|
premium: true,
|
||||||
playSimilar: client.config.playSimilar,
|
autoPlay: client.config.autoPlay,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,20 @@ module.exports = {
|
|||||||
queue.votes = 0;
|
queue.votes = 0;
|
||||||
queue.voters = [];
|
queue.voters = [];
|
||||||
if (queue.endReason !== "replay") {
|
if (queue.endReason !== "replay") {
|
||||||
if (queue.endReason === "previous") queue.songs.unshift(queue.prevSongs.pop())
|
if (queue.endReason === "previous")
|
||||||
if (queue.endReason !== "previous") queue.prevSongs.push(queue.songs.shift());
|
queue.songs.unshift(queue.prevSongs.pop());
|
||||||
if (client.global.db.guilds[guild.id].playSimilar && !queue.songs[0] && queue.endReason !== "stop") {
|
if (queue.endReason !== "previous")
|
||||||
const prevSongs = queue.prevSongs.filter(song => song.type == "spotify");
|
queue.prevSongs.push(queue.songs.shift());
|
||||||
if (prevSongs.length >= 0) return findSimilar(client, queue, prevSongs, guild);
|
if (
|
||||||
|
client.global.db.guilds[guild.id].autoPlay &&
|
||||||
|
!queue.songs[0] &&
|
||||||
|
queue.endReason !== "stop"
|
||||||
|
) {
|
||||||
|
const prevSongs = queue.prevSongs.filter(
|
||||||
|
(song) => song.type == "spotify"
|
||||||
|
);
|
||||||
|
if (prevSongs.length >= 0)
|
||||||
|
return findSimilar(client, queue, prevSongs, guild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,8 +42,8 @@ module.exports = {
|
|||||||
|
|
||||||
function findSimilar(client, queue, prevSongs, guild) {
|
function findSimilar(client, queue, prevSongs, guild) {
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
const query = prevSongs[Math.floor(Math.random() * Math.floor(prevSongs.length))];
|
const query =
|
||||||
if (!query) return client.funcs.play(guild, queue.songs[0], client, 0, true);
|
prevSongs[Math.floor(Math.random() * Math.floor(prevSongs.length))];
|
||||||
similarSongs.find({
|
similarSongs.find({
|
||||||
title: query.track.name,
|
title: query.track.name,
|
||||||
artist: query.track.artists[0].name,
|
artist: query.track.artists[0].name,
|
||||||
@ -44,16 +53,21 @@ function findSimilar(client, queue, prevSongs, guild) {
|
|||||||
youtubeAPIKey: client.config.api_key,
|
youtubeAPIKey: client.config.api_key,
|
||||||
},
|
},
|
||||||
async function (err, songs) {
|
async function (err, songs) {
|
||||||
if (err) return queue.textChannel.send(err.message);
|
if (err) {
|
||||||
|
console.log(err.message);
|
||||||
|
return queue.textChannel.send(client.messages.error);
|
||||||
|
}
|
||||||
if (songs[0]) {
|
if (songs[0]) {
|
||||||
const random = Math.floor(Math.random() * Math.floor(songs.length))
|
const random = Math.floor(Math.random() * Math.floor(songs.length));
|
||||||
const songInfo = await ytdl.getInfo(`https://www.youtube.com/watch?v=${songs[random].youtubeId}`);
|
const songInfo = await ytdl.getInfo(
|
||||||
|
`https://www.youtube.com/watch?v=${songs[random].youtubeId}`
|
||||||
|
);
|
||||||
queue.songs.push({
|
queue.songs.push({
|
||||||
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title),
|
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title),
|
||||||
url: `https://www.youtube.com/watch?v=${songs[random].youtubeId}`,
|
url: `https://www.youtube.com/watch?v=${songs[random].youtubeId}`,
|
||||||
author: {},
|
author: {},
|
||||||
type: "ytdl",
|
type: "ytdl",
|
||||||
info: songInfo.videoDetails
|
info: songInfo.videoDetails,
|
||||||
});
|
});
|
||||||
client.funcs.play(guild, queue.songs[0], client, 0, true);
|
client.funcs.play(guild, queue.songs[0], client, 0, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,8 +22,7 @@ module.exports = {
|
|||||||
secondary_test_channel: "570531724002328577",
|
secondary_test_channel: "570531724002328577",
|
||||||
devId: "360363051792203779",
|
devId: "360363051792203779",
|
||||||
embedColor: "#b50002",
|
embedColor: "#b50002",
|
||||||
invite:
|
invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot",
|
||||||
"https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot",
|
|
||||||
supportServer: "https://discord.gg/rvHuJtB",
|
supportServer: "https://discord.gg/rvHuJtB",
|
||||||
devMode: false,
|
devMode: false,
|
||||||
api: false,
|
api: false,
|
||||||
@ -41,7 +40,7 @@ module.exports = {
|
|||||||
djrole: null,
|
djrole: null,
|
||||||
startPlaying: true,
|
startPlaying: true,
|
||||||
bass: 1,
|
bass: 1,
|
||||||
playSimilar: false,
|
autoPlay: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.streamConfig = {
|
module.exports.streamConfig = {
|
||||||
|
@ -5,7 +5,7 @@ const {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
emojis: emojis,
|
emojis: emojis,
|
||||||
albumAdded: emojis.green_check_mark +
|
albumAdded: emojis.green_check_mark +
|
||||||
"Album: **%TITLE%** has been added to the queue!",
|
"Album has been added to the queue!",
|
||||||
alreadyPaused: emojis.redx + "The music is already paused!",
|
alreadyPaused: emojis.redx + "The music is already paused!",
|
||||||
alreadyVoted: emojis.redx + "You have already voted to skip!",
|
alreadyVoted: emojis.redx + "You have already voted to skip!",
|
||||||
announceSongs: emojis.megaPhone + "Current setting:",
|
announceSongs: emojis.megaPhone + "Current setting:",
|
||||||
|
@ -11,7 +11,7 @@ module.exports = async function (client) {
|
|||||||
bass: client.config.bass,
|
bass: client.config.bass,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
premium: false,
|
premium: false,
|
||||||
playSimilar: client.config.playSimilar,
|
autoPlay: client.config.autoPlay,
|
||||||
});
|
});
|
||||||
client.global.db.guilds[guild.id] = {
|
client.global.db.guilds[guild.id] = {
|
||||||
prefix: client.config.prefix,
|
prefix: client.config.prefix,
|
||||||
@ -23,7 +23,7 @@ module.exports = async function (client) {
|
|||||||
bass: client.config.bass,
|
bass: client.config.bass,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
premium: false,
|
premium: false,
|
||||||
playSimilar: client.config.playSimilar,
|
autoPlay: client.config.autoPlay,
|
||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -47,6 +47,6 @@ module.exports = async function (client) {
|
|||||||
client.global.db.guilds[guild.id].blacklist = [];
|
client.global.db.guilds[guild.id].blacklist = [];
|
||||||
if (!client.global.db.guilds[guild.id].premium)
|
if (!client.global.db.guilds[guild.id].premium)
|
||||||
client.global.db.guilds[guild.id].premium = false;
|
client.global.db.guilds[guild.id].premium = false;
|
||||||
if (!client.global.db.guilds[guild.id].playSimilar) client.global.db.guilds[guild.id].playSimilar = client.config.playSimilar
|
if (!client.global.db.guilds[guild.id].autoPlay) client.global.db.guilds[guild.id].autoPlay = client.config.autoPlay
|
||||||
});
|
});
|
||||||
};
|
};
|
@ -12,7 +12,7 @@ module.exports = async function (client) {
|
|||||||
bass: client.global.db.guilds[guild.id].bass,
|
bass: client.global.db.guilds[guild.id].bass,
|
||||||
blacklist: client.global.db.guilds[guild.id].blacklist,
|
blacklist: client.global.db.guilds[guild.id].blacklist,
|
||||||
premium: client.global.db.guilds[guild.id].premium,
|
premium: client.global.db.guilds[guild.id].premium,
|
||||||
playSimilar: client.global.db.guilds[guild.id].playSimilar
|
autoPlay: client.global.db.guilds[guild.id].autoPlay
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user