1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-07-07 01:20:48 +00:00

Chore update 3.7

This commit is contained in:
MatteZ02
2020-06-30 20:43:00 +03:00
parent 0e25ac5752
commit 2353262322
18 changed files with 384 additions and 129 deletions

View File

@ -1,4 +1,5 @@
const ytsr = require('ytsr');
const SpotifyApi = require("spotify-web-api-node");
const he = require('he');
module.exports = {
@ -10,6 +11,12 @@ module.exports = {
permission: 'none',
category: 'music',
async execute(msg, args, client, Discord, command) {
const spotify = new SpotifyApi({
id: client.config.spotify_client_id,
secret: client.config.spotify_client_secret,
});
spotify.setAccessToken(client.config.spotify_access_key);
const searchString = args.slice(1).join(" ");
const queue = client.queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
@ -47,6 +54,20 @@ module.exports = {
return msg.channel.send(client.messages.cancellingVideoSelection);
}
const videoIndex = parseInt(response.first().content) - 1;
spotify.searchTracks(`track:${videos[videoIndex].title}`)
.then(function (data) {
client.funcs.handleVideo(
videoResults[0].link,
msg,
voiceChannel,
client,
false,
"ytdl",
data.body.tracks.items[0]
);
}, function (err) {
console.log('Something went wrong!', err);
});
return client.funcs.handleVideo(videos[videoIndex].link, msg, voiceChannel, client, false, "ytdl");
})
}