From 9315765650f4fd92dcb6a8be894797d541ff736f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Sat, 20 Jul 2024 18:40:59 +0200 Subject: [PATCH] fix: lilybird things --- .gitignore | 2 +- bun.lockb | Bin 19995 -> 19997 bytes package.json | 2 +- src/commands/docs.ts | 4 ++-- src/commands/github.ts | 2 +- src/commands/mdn.ts | 2 +- src/commands/ping.tsx | 2 +- src/commands/tag.ts | 2 +- src/commands/version.ts | 2 +- src/index.ts | 8 +++++--- 10 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 9f30e4f..3c1bc4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # Created by https://www.toptal.com/developers/gitignore/api/node # Edit at https://www.toptal.com/developers/gitignore?templates=node -files/database.sqlite +**/lily-cache/ ### Node ### # Logs diff --git a/bun.lockb b/bun.lockb index b50b1da426525e9c578d9b65d540489fc475d33a..60087a2adf020300195f5c6b1f57feacc1698197 100755 GIT binary patch delta 1792 zcmbtVeNa?Y6uJ>_)h!zti4TLZ@4aN~TiODB{k-(slv3Ou7 zPzDwN6M%;ej7C7{`$BI#49Ct75BgWlm%x z63Pb`fmC~|cdhrbx6kqM?h83qb_t0kNj9FTkarIKM~1 z5QSSwHYof6c?^p2GU~gO$_*}a8Y;U0Q%#g&aPYMx8x{UJc_8nT->8^hMzMw6Kq*EC zKS;7k;XjkdR1h1F>_t}CTm5EJw`m@CQqZIr$55(ebj9Q{+D(kDQrX*JD^xZFR;037 zp^Uw#vK?SAsq7NiQk6{)W2{(Zm0+50*MICjScz&~j-0osEC9AnWw8iN+qV)-U4?g3 zaGJu?NDfC{sLv8aFHwcTVg4AJ0xd*jX%5AqxS@qoO1Q(ka#BNuP=O}$L@2z6{E+u4 z2$@fEq{4TQ2l7kuLrN5kRLl!;fpKC!MimhbV-2(-DvwGEx7k?2jHD~YAMD*veIZG_ zpZrk@H&76A70J;GZzK<7f50D|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7;J%RorjuNtE>~ORAmuJO*^+7Ox=YaC4aEO z<46ucUFgqC$X=o{gWbFjngT6ARB1NhM{z<6q}UL`eKU6lxZd?m3mrBAWhGa0dyZKK1@-M!uqjLch`9<=E zDO@5yQRY4>OP4MBCGK6s-v1-=W{kwu z!&4X=q!vUxqAT!?q;7B<^+V2~BiN&u!tHXJ{)V)?zOj0!cE|mv(fTX%!NBD^w?1<3 zeQMcHx9qY-e~tQFsaxm%@cqH3_G{E;*K^d)QX}|CIjW8)d5+4^@_+NtGSIr9WuWCZ zl573c^io;%_FyHQAb;Lu;KfcTzLt z89Lys%SgggCoad=J3AkrUr=~3>&gGjPxV{e5f!=p^P!J}{Xpf?=9M{Flh$Qo81cPD Tg_-kthOZ;DH4I?OyT|_pMWN^| diff --git a/package.json b/package.json index 8eef437..b450e60 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "prettier": "3.3.3" }, "dependencies": { - "@lilybird/handlers": "^0.6.0-beta.9", + "@lilybird/handlers": "^0.6.0-beta.11", "@lilybird/jsx": "0.3.0", "@lilybird/transformers": "^0.4.1", "@paperdave/logger": "^3.0.1", diff --git a/src/commands/docs.ts b/src/commands/docs.ts index b20cd3f..8537030 100644 --- a/src/commands/docs.ts +++ b/src/commands/docs.ts @@ -1,7 +1,7 @@ import { AllowedMentionType, ApplicationCommandOptionType } from "lilybird"; -import { $applicationCommand } from "@lilybird/handlers/advanced"; +import { $applicationCommand } from "../handler.ts"; import algoliasearch from "algoliasearch"; -import { safeSlice } from "src/util.ts"; +import { safeSlice } from "../util.ts"; // @ts-expect-error It is callable, but algolia for some reason has a namespace with the same name const algoliaClient = algoliasearch( diff --git a/src/commands/github.ts b/src/commands/github.ts index 8570fab..38bcfd1 100644 --- a/src/commands/github.ts +++ b/src/commands/github.ts @@ -1,5 +1,5 @@ -import { $applicationCommand } from "@lilybird/handlers/advanced"; import { ApplicationCommandOptionType } from "lilybird"; +import { $applicationCommand } from "../handler.ts"; import { safeSlice, silently } from "../util.ts"; type State = diff --git a/src/commands/mdn.ts b/src/commands/mdn.ts index 53dc7b6..0e4a959 100644 --- a/src/commands/mdn.ts +++ b/src/commands/mdn.ts @@ -1,7 +1,7 @@ // https://github.com/discordjs/discord-utils-bot/blob/main/src/functions/autocomplete/mdnAutoComplete.ts#L23-L47 thanks // https://github.com/discordjs/discord-utils-bot/blob/main/src/functions/mdn.ts#L59C1-L78C3 thanks import { ApplicationCommandOptionType, AllowedMentionType } from "lilybird"; -import { $applicationCommand } from "@lilybird/handlers/advanced"; +import { $applicationCommand } from "../handler.ts"; import { MDN_API, MDN_DISCORD_EMOJI } from "src/constants.ts"; import { safeSlice, silently } from "src/util.ts"; diff --git a/src/commands/ping.tsx b/src/commands/ping.tsx index e4155c3..83f8744 100644 --- a/src/commands/ping.tsx +++ b/src/commands/ping.tsx @@ -1,4 +1,4 @@ -import { $applicationCommand } from "@lilybird/handlers/advanced"; +import { $applicationCommand } from "../handler.ts"; import { serializers as S } from "@purplet/serialize"; import { ActionRow, Button } from "@lilybird/jsx"; import { possibleClosedForm, silently } from "../util.ts"; diff --git a/src/commands/tag.ts b/src/commands/tag.ts index 9a2ab75..cd1592b 100644 --- a/src/commands/tag.ts +++ b/src/commands/tag.ts @@ -1,5 +1,5 @@ import { AllowedMentionType, ApplicationCommandOptionType } from "lilybird"; -import { $applicationCommand } from "@lilybird/handlers/advanced"; +import { $applicationCommand } from "../handler.ts"; import { getTags, searchTag } from "../loaders/tags.ts"; $applicationCommand({ diff --git a/src/commands/version.ts b/src/commands/version.ts index 15bd4f3..0a9fba0 100644 --- a/src/commands/version.ts +++ b/src/commands/version.ts @@ -1,4 +1,4 @@ -import { $applicationCommand } from "@lilybird/handlers/advanced"; +import { $applicationCommand } from "../handler.ts"; import { COMMIT_HASH, diff --git a/src/index.ts b/src/index.ts index 3662b97..45bc058 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ process.on("uncaughtException", console.error); handler.cachePath = `${import.meta.dir}/lily-cache/handler`; +handler.addDebugListener(console.log); await handler.scanDir(`${import.meta.dir}/commands`); await handler.scanDir(`${import.meta.dir}/listeners`); @@ -29,12 +30,13 @@ const listeners = if ( typeof listeners.messageCreate !== "undefined" && typeof messageCreate !== "undefined" -) +) { + const oldListener = listeners.messageCreate!; listeners.messageCreate = async (m) => { - await listeners.messageCreate!(m); + await oldListener(m); await messageCreate(m); }; -else if (typeof messageCreate !== "undefined") +} else if (typeof messageCreate !== "undefined") listeners.messageCreate = messageCreate; await createClient({