mirror of
https://github.com/sern-handler/awesome-plugins
synced 2026-06-06 01:16:51 +00:00
chore: update publish.ts to use backwards compatible service (#96)
This commit is contained in:
@@ -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<T>(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,
|
||||
|
||||
Reference in New Issue
Block a user