diff --git a/commands/Music/play.js b/commands/Music/play.js index 1931d41..6af49b3 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -47,7 +47,7 @@ module.exports = { autoPlay: true }); - if (isYouTubeUrl(query) || user_source ? sources[user_source.source].require.includes("YOUTUBE_DIRECT") : false) { + if (isYouTubeUrl(query)) { const canDirect = await YoutubeDirectSchema.findOne({ userId: interaction.user.id }); @@ -62,6 +62,32 @@ module.exports = { }); } + if (user_source ? sources[user_source.source].require.includes("YOUTUBE_DIRECT") : false) { + const canDirect = await YoutubeDirectSchema.findOne({ + userId: interaction.user.id + }); + + const adsButton = new ButtonBuilder() + .setURL("https://hstudio.hewkawar.xyz/store") + .setLabel(locale.getLocaleString("youtube.direct.disable.button.text")) + .setStyle(ButtonStyle.Link); + + const adsActionRow = new ActionRowBuilder() + .addComponents(adsButton); + + if (!(canDirect && canDirect.userId && canDirect.userId == interaction.user.id)) return interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setColor(Colors.Red) + .setDescription(locale.getLocaleString("youtube.direct.disable.text")) + .setImage("https://cdn.jsdelivr.net/gh/HStudioDiscordBot/Storage@main/ads/HStudio.ads.youtube_direct_user.png") + ], + components: [ + adsActionRow + ] + }); + } + if (isHStudioPlayUrl(query)) { query = query.replace("play.hstudio.hewkawar.xyz", "www.youtube.com"); } diff --git a/locales/en-US.json b/locales/en-US.json index 651dccd..d3f8d9e 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -119,5 +119,6 @@ "command.clear.fail": "❌ Can't clear queue", "command.setting.search.saved": "💾 Saved default source with `{0}`", "command.setting.search.save.fail": "❌ Fail to save default source with `{0}`", - "crowdin.test.translate": "Testing translate" + "youtube.direct.disable.text": "# Want to listen to music directly from YouTube?\nYou can easily order through the HStudio website\n\n**[Support Discord](https://discord.gg/GzTbuZHTEx)**", + "youtube.direct.disable.button.text": "Buy now" } \ No newline at end of file