diff --git a/src/plugins/rule34/commands.ts b/src/plugins/rule34/commands.ts index 80107e5..2b518d3 100644 --- a/src/plugins/rule34/commands.ts +++ b/src/plugins/rule34/commands.ts @@ -1,33 +1,5 @@ import { ChatInputCommandInteraction, SlashCommandBuilder } from "@discordjs"; import { requestWorker } from "@root/plugins/rule34/plugin.ts"; -// import { drop, help, requestWorker } from "./plugin.ts"; - - -// export async function rule34MessageHandler(message: Message) { -// const command = message.content.trim().split(" ").slice(1).join(" "); -// if (command === "drop") { -// bot.helpers.sendMessage(message.channelId, { -// embeds: [await drop()] -// }) -// } else if (command.startsWith("drop [") && command.endsWith("]")) { -// logMessage(message); -// const generatedEmbeds: Embed[] = await requestWorker(command); -// for (const embed of generatedEmbeds) { -// bot.helpers.sendMessage(message.channelId, { -// embeds: [embed], -// }); -// } -// } else if (command === "help") { -// logMessage(message); - -// bot.helpers.sendMessage(message.channelId, { -// content: defaultString(help()), -// }); -// } else { -// drop(); -// } -// } - export const commands = [ { diff --git a/src/plugins/rule34/plugin.ts b/src/plugins/rule34/plugin.ts index 3326516..2191514 100644 --- a/src/plugins/rule34/plugin.ts +++ b/src/plugins/rule34/plugin.ts @@ -10,33 +10,6 @@ export type PostRequestParameters = { page?: string| null| undefined, } -// export async function drop() { -// try { -// const response = await requestJSON(`${postUrl}&limit=1`); -// const img = response[0]; -// if (img === undefined) throw Error("An undefined Array was given!"); -// return new Embed( -// `ID: ${img.id}`, -// img.sample_url, -// new EmbedAuthor(img.owner), -// // [new EmbedField("Tags", img.tags, true)], -// new EmbedImage(img.file_url, img.height, img.width), -// ); -// } catch (e) { -// console.error((e as Error).message); -// return new Embed( -// "Error Message", -// "https://gifdb.com/images/thumbnail/nuh-uh-demon-slayer-girl-hm7q3hqa4lnqyl6d.gif", -// new EmbedAuthor("fzzinChemical"), -// new EmbedImage( -// "https://gifdb.com/images/thumbnail/nuh-uh-demon-slayer-girl-hm7q3hqa4lnqyl6d.gif", -// 250, -// 250, -// ), -// ); -// } -// } - export async function requestWorker(postRequestParams: PostRequestParameters) { const embeds = []; try { diff --git a/src/plugins/rule34/test.ts b/src/plugins/rule34/test.ts index 8cb80bf..c958d0a 100644 --- a/src/plugins/rule34/test.ts +++ b/src/plugins/rule34/test.ts @@ -1,25 +1,20 @@ -import { assert } from "jsr:@std/assert"; -import { drop, generateRequestURL, requestParser, requestWorker } from "@root/plugins/rule34/plugin.ts"; - -Deno.test("Test Request Parser", () => { - assert( - requestParser("[limit: 12,tags:bro+likes+bread]"), - '{ "limit" => "12", "tags" => "bro+likes+bread" }', - ); -}); +import {generateRequestURL, requestWorker } from "@root/plugins/rule34/plugin.ts"; Deno.test("Test URL Search Parameters", () => { - console.debug(generateRequestURL("[limit:3]")); -}); - -Deno.test("Test Drop", async () => { - console.debug(await drop()); + console.debug(generateRequestURL( + {limit: "3"} + )); }); Deno.test("Test Request Workder", async () => { - console.debug(await requestWorker("[limit: 12,tags:sfw]")); + console.debug(await requestWorker({ + limit: "12", + tags: "sfw", + })); }); + + Deno.test("Test Request Workder 2", async () => { - console.debug(await requestWorker("[limit: 5,tags: AI+catgirl]")); + console.debug(await requestWorker({limit: "5",tags: "AI+catgirl"})); });