From cef6b7f1411ddcf04afe48e4ee95d1d224476e63 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sun, 23 Jul 2023 11:59:04 +0200 Subject: [PATCH 1/2] fix: Handle youtube graphic or violent imagery warning --- src/commands/player/play.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/commands/player/play.js b/src/commands/player/play.js index ad47c31..a353a0c 100644 --- a/src/commands/player/play.js +++ b/src/commands/player/play.js @@ -109,6 +109,18 @@ module.exports = { }); } + if (error.message.includes('The following content may contain graphic or violent imagery')) { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription( + `**${embedOptions.icons.warning} Cannot retrieve audio for track**\nThis audio source cannot be played as the video source has a warning for graphic or violent imagery. It requires a manual confirmation to to play the video, and because of this I am unable to extract the audio for this source.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._` + ) + .setColor(embedOptions.colors.warning) + ] + }); + } + if ( (error.type === 'TypeError' && (error.message.includes('Cannot read properties of null (reading \'createStream\')') || From 50f4157648787dde248d8bf8683b905b5e3fef23 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sun, 23 Jul 2023 12:02:25 +0200 Subject: [PATCH 2/2] fix: add logging for youtube confirmation errors --- src/commands/player/play.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/player/play.js b/src/commands/player/play.js index a353a0c..861c0b2 100644 --- a/src/commands/player/play.js +++ b/src/commands/player/play.js @@ -98,6 +98,9 @@ module.exports = { logger.debug(`[Shard ${interaction.guild.shardId}] player.play() successful. Query: ${query}.`); } catch (error) { if (error.message.includes('Sign in to confirm your age')) { + logger.debug( + `[Shard ${interaction.guild.shardId}] Found track but failed to retrieve audio due to age confirmation warning.` + ); return await interaction.editReply({ embeds: [ new EmbedBuilder() @@ -110,6 +113,9 @@ module.exports = { } if (error.message.includes('The following content may contain graphic or violent imagery')) { + logger.debug( + `[Shard ${interaction.guild.shardId}] Found track but failed to retrieve audio due to graphic or violent imagery warning.` + ); return await interaction.editReply({ embeds: [ new EmbedBuilder()