guh
This commit is contained in:
parent
7dd81081a2
commit
9f7275269f
1 changed files with 14 additions and 12 deletions
|
@ -24,15 +24,14 @@ const data = new SlashCommandBuilder()
|
|||
.setName("tags")
|
||||
.setRequired(false)
|
||||
.setDescription("Tags to search for")
|
||||
.setAutocomplete(true)
|
||||
)
|
||||
/*.addStringOption(builder =>
|
||||
.addStringOption(builder =>
|
||||
builder //
|
||||
.setName("booru")
|
||||
.setRequired(false)
|
||||
.setDescription("Booru board to search (default: gelbooru)")
|
||||
.addChoices(boorus)
|
||||
)*/
|
||||
)
|
||||
.addBooleanOption(builder =>
|
||||
builder //
|
||||
.setName("nsfw")
|
||||
|
@ -95,15 +94,13 @@ function formatTime(time) {
|
|||
return `${(Number(time) / 1e6).toFixed(2)}ms`
|
||||
}
|
||||
|
||||
const aiTags = [
|
||||
"ai_art",
|
||||
"ai_generated"
|
||||
const blacklist = [
|
||||
"-ai_generated",
|
||||
"-ai_art",
|
||||
"-child",
|
||||
"-loli"
|
||||
];
|
||||
|
||||
function isAIPost(post) {
|
||||
return aiTags.map(i => post.tags.includes(i)).includes(true);
|
||||
}
|
||||
|
||||
var credentials = JSON.parse(readFileSync("credentials.json"));
|
||||
|
||||
function proxy(url) {
|
||||
|
@ -124,11 +121,16 @@ module.exports = {
|
|||
data,
|
||||
async execute(interaction) {
|
||||
const tags = (interaction.options.getString("tags") ?? "").split(" ");
|
||||
const containsBlacklist = tags.filter(i => blacklist.includes("-" + i));
|
||||
if (containsBlacklist.length > 0) {
|
||||
await interaction.followUp(`<:warning:1293874152150667315> kill yourself.\n(searched for blacklisted tags: \`${containsBlacklist.join(", ")}\`)`);
|
||||
return;
|
||||
}
|
||||
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
||||
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
||||
|
||||
await interaction.deferReply();
|
||||
const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags];
|
||||
const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags, ...blacklist];
|
||||
|
||||
const startTime = process.hrtime.bigint();
|
||||
|
||||
|
@ -139,7 +141,7 @@ module.exports = {
|
|||
await interaction.followUp("<:warning:1293874152150667315> Could not find any post matching tags.");
|
||||
return;
|
||||
}
|
||||
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
|
||||
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost) || isFucked(newPost)) continue;
|
||||
post = newPost;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue