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 b50b1da..60087a2 100755 Binary files a/bun.lockb and b/bun.lockb differ 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({