2022-12-17 13:33:33 +05:00
|
|
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js");
|
2022-07-29 23:31:08 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand"),
|
|
|
|
fetch = require("node-fetch");
|
|
|
|
|
|
|
|
class NSFW extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
2023-03-26 18:31:19 +05:00
|
|
|
.setName("pic")
|
|
|
|
.setDescription(client.translate("nsfw/pic:DESCRIPTION"))
|
|
|
|
.setDescriptionLocalizations({ "uk": client.translate("nsfw/pic:DESCRIPTION", null, "uk-UA") })
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(true),
|
2022-07-29 23:31:08 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
2022-08-01 20:06:09 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-07-29 23:31:08 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
2022-08-28 21:53:54 +05:00
|
|
|
await interaction.deferReply({ ephemeral: true });
|
|
|
|
|
2023-02-01 00:23:01 +05:00
|
|
|
if (interaction.guildId && !interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true, edit: true });
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
|
|
|
|
JSON.parse(JSON.stringify({
|
|
|
|
label: tag,
|
2022-12-15 21:02:38 +05:00
|
|
|
value: tag,
|
|
|
|
})),
|
2022-10-11 15:19:22 +05:00
|
|
|
);
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
const row = new ActionRowBuilder()
|
|
|
|
.addComponents(
|
2022-12-17 13:33:33 +05:00
|
|
|
new StringSelectMenuBuilder()
|
2022-10-11 15:19:22 +05:00
|
|
|
.setCustomId("nsfw_select")
|
|
|
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
2022-12-15 21:02:38 +05:00
|
|
|
.addOptions(tags),
|
2022-10-11 15:19:22 +05:00
|
|
|
);
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-13 00:05:36 +05:00
|
|
|
const msg = await interaction.editReply({
|
2022-10-11 15:19:22 +05:00
|
|
|
content: interaction.translate("common:AVAILABLE_OPTIONS"),
|
|
|
|
ephemeral: true,
|
2022-10-13 00:05:36 +05:00
|
|
|
fetchReply: true,
|
2022-12-15 21:02:38 +05:00
|
|
|
components: [row],
|
2022-10-11 15:19:22 +05:00
|
|
|
});
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
const filter = i => i.user.id === interaction.user.id;
|
2022-10-13 00:05:36 +05:00
|
|
|
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) });
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
collector.on("collect", async i => {
|
2022-12-17 13:33:33 +05:00
|
|
|
if (i.isStringSelectMenu() && i.customId === "nsfw_select") {
|
2022-10-11 15:19:22 +05:00
|
|
|
i.deferUpdate();
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
const tag = i?.values[0];
|
2022-12-17 13:33:33 +05:00
|
|
|
const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json());
|
2022-07-29 23:31:08 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setColor(client.config.embed.color)
|
|
|
|
.setFooter({
|
2022-12-15 21:02:38 +05:00
|
|
|
text: client.config.embed.footer,
|
2022-10-11 15:19:22 +05:00
|
|
|
})
|
|
|
|
.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();
|
2022-08-26 00:21:26 +05:00
|
|
|
|
2022-10-11 15:19:22 +05:00
|
|
|
await interaction.editReply({
|
2022-12-15 21:02:38 +05:00
|
|
|
embeds: [embed],
|
2022-08-26 00:21:26 +05:00
|
|
|
});
|
2022-10-11 15:19:22 +05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
collector.on("end", () => {
|
|
|
|
return interaction.editReply({
|
2022-12-15 21:02:38 +05:00
|
|
|
components: [],
|
2022-08-28 21:53:54 +05:00
|
|
|
});
|
2022-10-11 15:19:22 +05:00
|
|
|
});
|
2022-07-29 23:31:08 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = NSFW;
|