From d3a7e4c318a68370277300005137ba7e3d882ded Mon Sep 17 00:00:00 2001 From: HewkawAr Date: Sat, 31 Aug 2024 14:12:16 +0700 Subject: [PATCH 1/2] Update play.js --- commands/Music/play.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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"); } From 5a590834e8440028c5c7b563237d240e793faee0 Mon Sep 17 00:00:00 2001 From: HewkawAr Date: Sat, 31 Aug 2024 14:12:42 +0700 Subject: [PATCH 2/2] Update en-US.json + youtube.direct.disable.text + youtube.direct.disable.button.text - crowdin.test.translate --- locales/en-US.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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