1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 02:00:20 +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",
"version": "3.7.2",
"version": "3.8.0",
"description": "V3 for Musix the discord music bot",
"main": "./index.js",
"scripts": {

View File

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

View File

@ -11,7 +11,7 @@ module.exports = {
if (client.funcs.check(client, msg, command)) {
if (!queue.paused) return msg.channel.send(client.messages.notPaused);
queue.paused = false;
queue.connection.dispatcher.resume(true);
queue.connection.dispatcher.resume();
return msg.channel.send(client.messages.resumed);
}
}

View File

@ -15,7 +15,7 @@ module.exports = {
queue.exists = false;
}
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);
}
queue.songs = [];

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ module.exports = {
idOrMentionChannel: emojis.redx + "Please provide a channel id or mention a channel!",
invalidGuild: emojis.redx + "Invalid guild id!",
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",
joinSupport: "Join the musix support server: ",
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"))
return msg.channel.send(client.messages.noPermsEmbed);
if (!permissions.has("USE_EXTERNAL_EMOJIS"))
return msg.channel.send(client.noPermsUseExternalEmojis);
return msg.channel.send(client.messages.noPermsUseExternalEmojis);
if (
command.category === "music" &&
client.global.db.guilds[msg.guild.id].blacklist.includes(msg.channel.id)