remove unnecessary codeblocks and refresh tests.
This commit is contained in:
@@ -1,33 +1,5 @@
|
|||||||
import { ChatInputCommandInteraction, SlashCommandBuilder } from "@discordjs";
|
import { ChatInputCommandInteraction, SlashCommandBuilder } from "@discordjs";
|
||||||
import { requestWorker } from "@root/plugins/rule34/plugin.ts";
|
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 = [
|
export const commands = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,33 +10,6 @@ export type PostRequestParameters = {
|
|||||||
page?: string| null| undefined,
|
page?: string| null| undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
// export async function drop() {
|
|
||||||
// try {
|
|
||||||
// const response = await requestJSON<ImageResponse[]>(`${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) {
|
export async function requestWorker(postRequestParams: PostRequestParameters) {
|
||||||
const embeds = [];
|
const embeds = [];
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,25 +1,20 @@
|
|||||||
import { assert } from "jsr:@std/assert";
|
import {generateRequestURL, requestWorker } from "@root/plugins/rule34/plugin.ts";
|
||||||
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" }',
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test("Test URL Search Parameters", () => {
|
Deno.test("Test URL Search Parameters", () => {
|
||||||
console.debug(generateRequestURL("[limit:3]"));
|
console.debug(generateRequestURL(
|
||||||
});
|
{limit: "3"}
|
||||||
|
));
|
||||||
Deno.test("Test Drop", async () => {
|
|
||||||
console.debug(await drop());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test("Test Request Workder", async () => {
|
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 () => {
|
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"}));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user