From 502deeff302a4c24ae22e6fb7419f99c9ac5064f Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Fri, 11 Aug 2023 11:44:39 -0500 Subject: [PATCH] chore: update publish.ts to use backwards compatible service (#96) --- TypeScript/publish.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TypeScript/publish.ts b/TypeScript/publish.ts index a108e25..fa37c39 100644 --- a/TypeScript/publish.ts +++ b/TypeScript/publish.ts @@ -23,6 +23,7 @@ import { controller, SernOptionsData, SlashCommand, + Service, } from "@sern/handler"; import { ApplicationCommandData, @@ -30,7 +31,6 @@ import { ApplicationCommandOptionType, PermissionResolvable, } from "discord.js"; -import { useContainer } from "../index.js"; export const CommandTypeRaw = { [CommandType.Both]: ApplicationCommandType.ChatInput, @@ -48,7 +48,13 @@ export function publish< >(options?: PublishOptions) { return CommandInitPlugin(async ({ module }) => { // Users need to provide their own useContainer function. - const [client] = useContainer("@sern/client"); + let client; + try { + client = (await import('@sern/handler')).Service('@sern/client') + } catch { + const { useContainer } = await import('../index.js') + client = useContainer("@sern/client")[0]; + } const defaultOptions = { guildIds: [], dmPermission: undefined,