2022-08-02 17:18:47 +05:00
|
|
|
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = 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()
|
|
|
|
.setName("nsfw")
|
|
|
|
.setDescription(client.translate("nsfw/nsfw:DESCRIPTION")),
|
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
|
|
|
guildOnly: true,
|
|
|
|
ownerOnly: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @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) {
|
|
|
|
if (!interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true });
|
|
|
|
|
|
|
|
const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
|
|
|
|
JSON.parse(JSON.stringify({
|
|
|
|
label: tag,
|
|
|
|
value: tag
|
|
|
|
}))
|
|
|
|
);
|
|
|
|
|
2022-07-31 17:08:00 +05:00
|
|
|
const row = new ActionRowBuilder()
|
2022-07-29 23:31:08 +05:00
|
|
|
.addComponents(
|
2022-07-31 17:08:00 +05:00
|
|
|
new SelectMenuBuilder()
|
2022-07-29 23:31:08 +05:00
|
|
|
.setCustomId("nsfw_select")
|
2022-07-31 17:08:00 +05:00
|
|
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
2022-07-29 23:31:08 +05:00
|
|
|
.addOptions(tags)
|
|
|
|
);
|
|
|
|
|
|
|
|
const msg = await interaction.reply({
|
2022-08-08 18:19:56 +05:00
|
|
|
content: interaction.translate("common:AVAILABLE_OPTIONS"),
|
2022-07-29 23:31:08 +05:00
|
|
|
ephemeral: true,
|
2022-07-31 17:08:00 +05:00
|
|
|
components: [row],
|
|
|
|
fetchReply: true
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
|
2022-08-06 20:47:47 +05:00
|
|
|
const filter = i => i.customId === "nsfw_select" && i.user.id === interaction.user.id;
|
2022-07-29 23:31:08 +05:00
|
|
|
const collector = new InteractionCollector(client, {
|
2022-08-06 20:47:47 +05:00
|
|
|
filter,
|
2022-08-02 17:18:47 +05:00
|
|
|
componentType: ComponentType.SelectMenu,
|
2022-07-29 23:31:08 +05:00
|
|
|
message: msg,
|
2022-07-31 17:08:00 +05:00
|
|
|
idle: 60 * 1000
|
2022-07-29 23:31:08 +05:00
|
|
|
});
|
|
|
|
|
2022-08-06 20:47:47 +05:00
|
|
|
collector.on("collect", async i => {
|
|
|
|
const tag = i?.values[0];
|
2022-07-29 23:31:08 +05:00
|
|
|
const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json());
|
|
|
|
|
2022-07-31 17:08:00 +05:00
|
|
|
const embed = new EmbedBuilder()
|
2022-07-29 23:31:08 +05:00
|
|
|
.setColor(client.config.embed.color)
|
|
|
|
.setFooter({
|
|
|
|
text: client.config.embed.footer
|
|
|
|
})
|
|
|
|
.setTitle(`${res.title}\n${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-06 20:47:47 +05:00
|
|
|
await i.update({
|
2022-07-29 23:31:08 +05:00
|
|
|
embeds: [embed]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = NSFW;
|