Put try/catch around call to ytdl-core-discord, to handle errors in that package related to playing age restricted videos
This commit is contained in:
parent
e36c072fb4
commit
d6aee75edb
11
bot.js
11
bot.js
@ -97,7 +97,7 @@ client.on('message', async message => {
|
|||||||
switch(message.content) {
|
switch(message.content) {
|
||||||
case "daytona":
|
case "daytona":
|
||||||
case "e":
|
case "e":
|
||||||
if (Math.random() > 0.8) return;
|
if (Math.random() < 0.8) return;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,9 +125,10 @@ client.on('message', async message => {
|
|||||||
// Otherwise process commands
|
// Otherwise process commands
|
||||||
if (message.content === "!help" ) {
|
if (message.content === "!help" ) {
|
||||||
console.log(`!help issued by ${message.author.tag} ${message.author.id}`);
|
console.log(`!help issued by ${message.author.tag} ${message.author.id}`);
|
||||||
var response = 'ZeSkypeBot v6.0.4 \'black pepper\'\n';
|
var response = 'ZeSkypeBot v6.0.5 \'black pepper\'\n';
|
||||||
response += 'Original by moosecrap#5953 for Skype, Remade by Weegee#6402 for Discord\n';
|
response += 'Original by moosecrap#5953 for Skype, Remade by Weegee#6402 for Discord\n';
|
||||||
response += 'Changelog:\n';
|
response += 'Changelog:\n';
|
||||||
|
response += 'v6.0.5 Added feedback for cases where ytdl crashes\n';
|
||||||
response += 'v6.0.3 Changed !play regex per user feedback and counterexamples\n';
|
response += 'v6.0.3 Changed !play regex per user feedback and counterexamples\n';
|
||||||
response += 'v6.0.2 Removed response to voiceless sound commands, for being too spammy\n';
|
response += 'v6.0.2 Removed response to voiceless sound commands, for being too spammy\n';
|
||||||
response += 'v6.0.1 Added !play for youtube videos\n';
|
response += 'v6.0.1 Added !play for youtube videos\n';
|
||||||
@ -152,10 +153,16 @@ client.on('message', async message => {
|
|||||||
//TODO: Factor out common code with the soundbyte play?
|
//TODO: Factor out common code with the soundbyte play?
|
||||||
const connection = await message.member.voice.channel.join();
|
const connection = await message.member.voice.channel.join();
|
||||||
// Play the video as requested
|
// Play the video as requested
|
||||||
|
try {
|
||||||
const dispatcher = connection.play(await ytdl(yturl), { type: 'opus', volume: 0.60 });
|
const dispatcher = connection.play(await ytdl(yturl), { type: 'opus', volume: 0.60 });
|
||||||
dispatcher.on('start', () => { console.log(`Playing ${yturl}`); });
|
dispatcher.on('start', () => { console.log(`Playing ${yturl}`); });
|
||||||
dispatcher.on('finish', () => { console.log(`Finished ${yturl}`); });
|
dispatcher.on('finish', () => { console.log(`Finished ${yturl}`); });
|
||||||
dispatcher.on('error', console.error);
|
dispatcher.on('error', console.error);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
message.channel.send("Bro youtube says this shit is porn, i aint playing that");
|
||||||
|
const dispatcher = connection.play('./sounds/cantlet.ogg');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user