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")
|
.setName("tags")
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
.setDescription("Tags to search for")
|
.setDescription("Tags to search for")
|
||||||
.setAutocomplete(true)
|
|
||||||
)
|
)
|
||||||
/*.addStringOption(builder =>
|
.addStringOption(builder =>
|
||||||
builder //
|
builder //
|
||||||
.setName("booru")
|
.setName("booru")
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
.setDescription("Booru board to search (default: gelbooru)")
|
.setDescription("Booru board to search (default: gelbooru)")
|
||||||
.addChoices(boorus)
|
.addChoices(boorus)
|
||||||
)*/
|
)
|
||||||
.addBooleanOption(builder =>
|
.addBooleanOption(builder =>
|
||||||
builder //
|
builder //
|
||||||
.setName("nsfw")
|
.setName("nsfw")
|
||||||
|
@ -95,15 +94,13 @@ function formatTime(time) {
|
||||||
return `${(Number(time) / 1e6).toFixed(2)}ms`
|
return `${(Number(time) / 1e6).toFixed(2)}ms`
|
||||||
}
|
}
|
||||||
|
|
||||||
const aiTags = [
|
const blacklist = [
|
||||||
"ai_art",
|
"-ai_generated",
|
||||||
"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"));
|
var credentials = JSON.parse(readFileSync("credentials.json"));
|
||||||
|
|
||||||
function proxy(url) {
|
function proxy(url) {
|
||||||
|
@ -124,11 +121,16 @@ module.exports = {
|
||||||
data,
|
data,
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const tags = (interaction.options.getString("tags") ?? "").split(" ");
|
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 booru = interaction.options.getString("booru") ?? defaultBooru;
|
||||||
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
||||||
|
|
||||||
await interaction.deferReply();
|
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();
|
const startTime = process.hrtime.bigint();
|
||||||
|
|
||||||
|
@ -139,7 +141,7 @@ module.exports = {
|
||||||
await interaction.followUp("<:warning:1293874152150667315> Could not find any post matching tags.");
|
await interaction.followUp("<:warning:1293874152150667315> Could not find any post matching tags.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
|
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost) || isFucked(newPost)) continue;
|
||||||
post = newPost;
|
post = newPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue