mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 00:23:17 +00:00
Update index.js
This commit is contained in:
parent
04314762cc
commit
7e6a6a03ef
5
index.js
5
index.js
@ -116,6 +116,7 @@ ${videos.map(video2 => `**${++index} -** ${video2.title}`).join('\n')}
|
|||||||
Please provide a value to select one of the search results ranging from __1-10__.
|
Please provide a value to select one of the search results ranging from __1-10__.
|
||||||
`);
|
`);
|
||||||
// eslint-disable-next-line max-depth
|
// eslint-disable-next-line max-depth
|
||||||
|
console.log('trying response')
|
||||||
try {
|
try {
|
||||||
var response = await msg.channel.awaitMessages(msg2 => msg2.content > 0 && msg2.content < 11, {
|
var response = await msg.channel.awaitMessages(msg2 => msg2.content > 0 && msg2.content < 11, {
|
||||||
maxMatches: 1,
|
maxMatches: 1,
|
||||||
@ -123,16 +124,20 @@ Please provide a value to select one of the search results ranging from __1-10__
|
|||||||
errors: ['time']
|
errors: ['time']
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log('Error 1')
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return msg.channel.send(':x: No or invalid value entered, cancelling video selection.');
|
return msg.channel.send(':x: No or invalid value entered, cancelling video selection.');
|
||||||
}
|
}
|
||||||
|
console.log('Start playing')
|
||||||
const videoIndex = parseInt(response.first().content);
|
const videoIndex = parseInt(response.first().content);
|
||||||
var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
|
var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log('Error 2')
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return msg.channel.send(':x: I could not obtain any search results.');
|
return msg.channel.send(':x: I could not obtain any search results.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('Play command done')
|
||||||
return handleVideo(video, msg, voiceChannel);
|
return handleVideo(video, msg, voiceChannel);
|
||||||
}
|
}
|
||||||
} else if (command === 'skip') {
|
} else if (command === 'skip') {
|
||||||
|
Loading…
Reference in New Issue
Block a user