From 58c7932481bfbb3d22aaa85013e30fd4143de806 Mon Sep 17 00:00:00 2001 From: fzzinchemical Date: Wed, 26 Mar 2025 17:33:25 +0100 Subject: [PATCH] Refactor API integration by moving rule34 and yandere APIs to plugins and updating message handling --- src/messages.ts | 6 +++--- src/{r34api.ts => plugins/rule34/api.ts} | 2 +- src/{yandereapi.ts => plugins/yandere/api.ts} | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename src/{r34api.ts => plugins/rule34/api.ts} (98%) rename src/{yandereapi.ts => plugins/yandere/api.ts} (100%) diff --git a/src/messages.ts b/src/messages.ts index ca3d1c1..a7d90f7 100755 --- a/src/messages.ts +++ b/src/messages.ts @@ -1,7 +1,7 @@ import { Bot, Message } from "npm:discordeno@18.0.1"; -import { dropdeineMutti, r34test, refresh } from "./r34api.ts"; +import { drop5, r34test, refresh } from "./plugins/rule34/api.ts"; import { logMessage } from "./logging.ts"; -import { dropYandere, dropYandere5, getPage, setPage } from "./yandereapi.ts"; +import { dropYandere, dropYandere5, getPage, setPage } from "./plugins/yandere/api.ts"; const prefix = Deno.env.get("BOT_PREFIX") ?? ""; if (!prefix) { @@ -31,7 +31,7 @@ export async function messagehandler(bot: Bot, message: Message) { message.guildId === undefined ) { bot.helpers.sendMessage(message.channelId, { - content: defaultString(await dropdeineMutti()), + content: defaultString(await drop5()), }); } break; diff --git a/src/r34api.ts b/src/plugins/rule34/api.ts similarity index 98% rename from src/r34api.ts rename to src/plugins/rule34/api.ts index a5954f3..8e88bd0 100755 --- a/src/r34api.ts +++ b/src/plugins/rule34/api.ts @@ -75,7 +75,7 @@ export async function r34test() { return hyperlinkarray.pop()!; } -export async function dropdeineMutti() { +export async function drop5() { let tmp = ""; for (let i = 0; i < 5; i++) { tmp += await r34test() + "\n"; diff --git a/src/yandereapi.ts b/src/plugins/yandere/api.ts similarity index 100% rename from src/yandereapi.ts rename to src/plugins/yandere/api.ts