This commit is contained in:
JonnyBro 2022-10-11 15:16:51 +05:00
parent 0a5720892a
commit c5343ad76e
2 changed files with 51 additions and 51 deletions

View file

@ -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 });
}
}

View file

@ -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"] }
});