From c5343ad76e0e8660fa031857679af7ee9c2f98da Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Tue, 11 Oct 2022 15:16:51 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/NSFW/nsfw.js | 100 +++++++++++++++++++++--------------------- index.js | 2 +- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/commands/NSFW/nsfw.js b/commands/NSFW/nsfw.js index 9f77f786..78e2f25d 100644 --- a/commands/NSFW/nsfw.js +++ b/commands/NSFW/nsfw.js @@ -34,60 +34,60 @@ class NSFW extends BaseCommand { async execute(client, interaction) { await interaction.deferReply({ ephemeral: true }); - if (!interaction.channel.nsfw || interaction.channel.type === ChannelType.DM) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true, edit: true }); - - const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag => - JSON.parse(JSON.stringify({ - label: tag, - value: tag - })) - ); - - const row = new ActionRowBuilder() - .addComponents( - new SelectMenuBuilder() - .setCustomId("nsfw_select") - .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(tags) + if (interaction.channel.type === ChannelType.DM || interaction.channel.nsfw) { + const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag => + JSON.parse(JSON.stringify({ + label: tag, + value: tag + })) ); - await interaction.editReply({ - content: interaction.translate("common:AVAILABLE_OPTIONS"), - ephemeral: true, - components: [row] - }); + const row = new ActionRowBuilder() + .addComponents( + new SelectMenuBuilder() + .setCustomId("nsfw_select") + .setPlaceholder(client.translate("common:NOTHING_SELECTED")) + .addOptions(tags) + ); - const filter = i => i.user.id === interaction.user.id; - const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) }); - - collector.on("collect", async i => { - if (i.isSelectMenu() && i.customId === "nsfw_select") { - i.deferUpdate(); - - const tag = i?.values[0]; - const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json()); - - const embed = new EmbedBuilder() - .setColor(client.config.embed.color) - .setFooter({ - text: client.config.embed.footer - }) - .setTitle(res.title) - .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`) - .setImage(res.url) - .setTimestamp(); - - await interaction.editReply({ - embeds: [embed] - }); - } - }); - - collector.on("end", () => { - return interaction.editReply({ - components: [] + await interaction.editReply({ + content: interaction.translate("common:AVAILABLE_OPTIONS"), + ephemeral: true, + components: [row] }); - }); + + const filter = i => i.user.id === interaction.user.id; + const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) }); + + collector.on("collect", async i => { + if (i.isSelectMenu() && i.customId === "nsfw_select") { + i.deferUpdate(); + + const tag = i?.values[0]; + const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json()); + + const embed = new EmbedBuilder() + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }) + .setTitle(res.title) + .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`) + .setImage(res.url) + .setTimestamp(); + + await interaction.editReply({ + embeds: [embed] + }); + } + }); + + collector.on("end", () => { + return interaction.editReply({ + components: [] + }); + }); + } else return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true, edit: true }); } } diff --git a/index.js b/index.js index 048e7340..dfdf3c1e 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const { GatewayIntentBits } = require("discord.js"), JaBa = require("./base/JaBa"); const client = new JaBa({ - intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.MessageContent ], + intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.MessageContent, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions ], allowedMentions: { parse: ["everyone", "roles", "users"] } });