From 267a27ec55b6562cced367f810040a9bc0f36375 Mon Sep 17 00:00:00 2001 From: fzzinchemical Date: Wed, 29 Oct 2025 10:19:54 +0100 Subject: [PATCH] fix small issue, where no image is given, when postid is undefined or null. Updated packages. --- deno.json | 9 ++++---- deno.lock | 41 +++++++++++++++++++++++++----------- src/bot.ts | 1 + src/plugins/rule34/api.ts | 2 +- src/plugins/rule34/plugin.ts | 2 +- 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/deno.json b/deno.json index d04c084..616d1d4 100755 --- a/deno.json +++ b/deno.json @@ -15,11 +15,12 @@ }, "imports": { "@discordjs": "npm:discord.js@14.18.0", - "@melvdouc/xml-parser": "jsr:@melvdouc/xml-parser@^0.1.1", - "@std/assert": "jsr:@std/assert@1", - "@types/node": "npm:@types/node@^22.14.1", + "@melvdouc/xml-parser": "jsr:@melvdouc/xml-parser@^0.1.2", + "@std/assert": "jsr:@std/assert@^1.0.15", + "@types/node": "npm:@types/node@^22.18.13", - "@root/" : "./src/" + "@root/" : "./src/", + "dotenv": "npm:dotenv@^17.2.3" }, "fmt": { "useTabs": true diff --git a/deno.lock b/deno.lock index c68a110..7ba395b 100644 --- a/deno.lock +++ b/deno.lock @@ -1,18 +1,28 @@ { - "version": "4", + "version": "5", "specifiers": { - "jsr:@melvdouc/xml-parser@*": "0.1.1", + "jsr:@melvdouc/xml-parser@*": "0.1.2", + "jsr:@melvdouc/xml-parser@~0.1.2": "0.1.2", + "jsr:@std/assert@^1.0.15": "1.0.15", "jsr:@std/dotenv@0.225.3": "0.225.3", "jsr:@std/fmt@^1.0.5": "1.0.6", "jsr:@std/fs@^1.0.11": "1.0.15", + "jsr:@std/internal@^1.0.12": "1.0.12", "jsr:@std/io@~0.225.2": "0.225.2", "jsr:@std/log@*": "0.224.14", - "npm:@types/node@^22.14.1": "22.14.1", - "npm:discord.js@14.18.0": "14.18.0" + "npm:@types/node@^22.18.13": "22.18.13", + "npm:discord.js@14.18.0": "14.18.0", + "npm:dotenv@^17.2.3": "17.2.3" }, "jsr": { - "@melvdouc/xml-parser@0.1.1": { - "integrity": "5c79d37c6471cb74efb344988317270b57b4f181decb873e441453db42eb6e5f" + "@melvdouc/xml-parser@0.1.2": { + "integrity": "37039f111ea12a2213a3073dadf41c32903c18da093b67f6192a999d36a5277a" + }, + "@std/assert@1.0.15": { + "integrity": "d64018e951dbdfab9777335ecdb000c0b4e3df036984083be219ce5941e4703b", + "dependencies": [ + "jsr:@std/internal" + ] }, "@std/dotenv@0.225.3": { "integrity": "a95e5b812c27b0854c52acbae215856d9cce9d4bbf774d938c51d212711e8d4a" @@ -23,6 +33,9 @@ "@std/fs@1.0.15": { "integrity": "c083fb479889d6440d768e498195c3fc499d426fbf9a6592f98f53884d1d3f41" }, + "@std/internal@1.0.12": { + "integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027" + }, "@std/io@0.225.2": { "integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7" }, @@ -110,8 +123,8 @@ "undici-types@6.20.0" ] }, - "@types/node@22.14.1": { - "integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", + "@types/node@22.18.13": { + "integrity": "sha512-Bo45YKIjnmFtv6I1TuC8AaHBbqXtIo+Om5fE4QiU1Tj8QR/qt+8O3BAtOimG5IFmwaWiPmB3Mv3jtYzBA4Us2A==", "dependencies": [ "undici-types@6.21.0" ] @@ -145,6 +158,9 @@ "undici" ] }, + "dotenv@17.2.3": { + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==" + }, "fast-deep-equal@3.1.3": { "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, @@ -178,10 +194,11 @@ }, "workspace": { "dependencies": [ - "jsr:@melvdouc/xml-parser@~0.1.1", - "jsr:@std/assert@1", - "npm:@types/node@^22.14.1", - "npm:discord.js@14.18.0" + "jsr:@melvdouc/xml-parser@~0.1.2", + "jsr:@std/assert@^1.0.15", + "npm:@types/node@^22.18.13", + "npm:discord.js@14.18.0", + "npm:dotenv@^17.2.3" ] } } diff --git a/src/bot.ts b/src/bot.ts index ba878e3..c32d794 100755 --- a/src/bot.ts +++ b/src/bot.ts @@ -9,6 +9,7 @@ import { commandRouter } from "@root/commands.ts"; import { EnvConst, loadConfig } from "@root/core/configLoader.ts"; const { promise, resolve, reject } = Promise.withResolvers(); + const env: EnvConst = loadConfig(); const client = new Client({ diff --git a/src/plugins/rule34/api.ts b/src/plugins/rule34/api.ts index 71df20b..79b7c7c 100755 --- a/src/plugins/rule34/api.ts +++ b/src/plugins/rule34/api.ts @@ -1,5 +1,5 @@ //TODO Add optional extensions like limit at Posts with tags etc. -import * as xml_parser from "jsr:@melvdouc/xml-parser"; +import * as xml_parser from "@melvdouc/xml-parser"; import { requestRaw } from "@root/structures/apiRequest.ts"; export type ImageResponse = { diff --git a/src/plugins/rule34/plugin.ts b/src/plugins/rule34/plugin.ts index 2191514..73d89f1 100644 --- a/src/plugins/rule34/plugin.ts +++ b/src/plugins/rule34/plugin.ts @@ -19,7 +19,7 @@ export async function requestWorker(postRequestParams: PostRequestParameters) { for (const post of response) { embeds.push( new EmbedBuilder() - .setTitle(post.id.toString()) + .setTitle(post.id + "") .setURL(post.file_url) .setAuthor( {