@mostfeatured/dbi 0.0.61 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DBI.d.ts +164 -156
- package/dist/DBI.d.ts.map +1 -1
- package/dist/DBI.js +332 -332
- package/dist/DBI.js.map +1 -1
- package/dist/methods/publishInteractions.d.ts.map +1 -1
- package/dist/methods/publishInteractions.js +236 -238
- package/dist/methods/publishInteractions.js.map +1 -1
- package/package.json +1 -1
- package/src/DBI.ts +7 -2
- package/src/methods/publishInteractions.ts +2 -4
package/dist/DBI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DBI.js","sourceRoot":"","sources":["../src/DBI.ts"],"names":[],"mappings":";;;;AAAA,oEAAiC;AACjC,2DAAiF;AACjF,yEAAyE;AACzE,uEAAoE;AACpE,yCAAyE;AACzE,qDAAkD;AAClD,iFAA8E;AAC9E,qCAAkC;AAClC,2CAAoF;AACpF,2CAA8D;AAC9D,mDAA0E;AAC1E,mEAAkG;AAClG,6DAAyF;AACzF,qEAAkE;AAClE,iFAA4C;AAC5C,yCAA2D;AAC3D,0EAAoD;AACpD,4DAAuB;AACvB,iEAA+F;AAG/F,qDAA6E;AA8E7E,MAAa,GAAG;IACd,SAAS,CAAa;IACtB,MAAM,CAAY;IAClB,MAAM,CAAuB;IAC7B,IAAI,CAYF;IACF,MAAM,CAAqB;IAC3B,OAAO,CAAmB;IAClB,OAAO,CAAU;IACjB,OAAO,CAAU;IACzB,YAAY,SAAqB,EAAE,MAA4B;QAC7D,IAAI,CAAC,SAAS,GAAG,SAAgB,CAAC;QAElC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAY,IAAI,IAAI,yBAAW,EAAE,CAAC;QACxD,MAAM,CAAC,QAAQ,GAAG;YAChB,MAAM,EAAE,IAAI;YACZ,wBAAwB,EAAE,EAAE;YAC5B,cAAc,EAAE,KAAK;YACrB,GAAG,CAAC,MAAM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AAE,CAAC,CAAC,CAAC,IAAI,IAAI,WAAW,IAAI,CAAC,CAAC,IAAI,IAAI,oBAAoB,IAAI,CAAC,CAAC,IAAI,IAAI,iBAAiB,CAAQ,CAAC;QACrJ,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE;YACf,KAAK,QAAQ,CAAC,CAAC;gBACb,OAAO,MAAM,IAAA,yCAAmB,EAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EACzB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,oBAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,EACjD,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAC5B,IAAI,CAAC,CAAC,CAAC,CACR,CAAC;aACH;YACD,KAAK,OAAO,CAAC,CAAC;gBACZ,OAAO,MAAM,IAAA,yCAAmB,EAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EACzB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,oBAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,EACjD,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAC5B,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,CACR,CAAC;aACH;SACF;IACH,CAAC;CAGF;AA7UD,kBA6UC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBIChatInput, TDBIChatInputOmitted } from \"./types/ChatInput/ChatInput\";\r\nimport { DBIChatInputOptions } from \"./types/ChatInput/ChatInputOptions\";\r\nimport { publishInteractions } from \"./methods/publishInteractions\";\r\nimport { ClientEvents, DBIEvent, TDBIEventOmitted } from \"./types/Event\";\r\nimport { MemoryStore } from \"./utils/MemoryStore\";\r\nimport { hookInteractionListeners } from \"./methods/hookInteractionListeners\";\r\nimport { Events } from \"./Events\";\r\nimport { DBILocale, TDBILocaleConstructor, TDBILocaleString } from \"./types/Locale\";\r\nimport { DBIButton, TDBIButtonOmitted } from \"./types/Button\";\r\nimport { DBISelectMenu, TDBISelectMenuOmitted } from \"./types/SelectMenu\";\r\nimport { DBIMessageContextMenu, TDBIMessageContextMenuOmitted } from \"./types/MessageContextMenu\";\r\nimport { DBIUserContextMenu, TDBIUserContextMenuOmitted } from \"./types/UserContextMenu\";\r\nimport { hookEventListeners } from \"./methods/hookEventListeners\";\r\nimport eventMap from \"./data/eventMap.json\";\r\nimport { DBIModal, TDBIModalOmitted } from \"./types/Modal\";\r\nimport * as Sharding from \"discord-hybrid-sharding\";\r\nimport _ from \"lodash\";\r\nimport { DBIInteractionLocale, TDBIInteractionLocaleOmitted } from \"./types/InteractionLocale\";\r\nimport { TDBIInteractions } from \"./types/Interaction\";\r\nimport { NamespaceData, NamespaceEnums } from \"../generated/namespaceData\";\r\nimport { DBICustomEvent, TDBICustomEventOmitted } from \"./types/CustomEvent\";\r\n\r\nexport interface DBIStore {\r\n get(key: string, defaultValue?: any): Promise<any>;\r\n set(key: string, value: any): Promise<void>;\r\n delete(key: string): Promise<void>;\r\n has(key: string): Promise<boolean>;\r\n}\r\n\r\nexport interface DBIConfig {\r\n discord: {\r\n token: string;\r\n options: Discord.ClientOptions\r\n }\r\n defaults: {\r\n locale: TDBILocaleString,\r\n directMessages: boolean,\r\n defaultMemberPermissions: Discord.PermissionsString[]\r\n };\r\n\r\n sharding: \"hybrid\" | \"default\" | \"off\";\r\n /**\r\n * Persist store. (Default to MemoryStore thats not persis tho.)\r\n */\r\n store: DBIStore;\r\n\r\n references: {\r\n autoClear?: {\r\n check: number;\r\n ttl: number;\r\n }\r\n };\r\n\r\n strict: boolean;\r\n}\r\n\r\nexport interface DBIConfigConstructor {\r\n discord: {\r\n token: string;\r\n options: Discord.ClientOptions\r\n }\r\n defaults?: {\r\n locale?: TDBILocaleString,\r\n directMessages?: boolean,\r\n defaultMemberPermissions?: Discord.PermissionsString[]\r\n };\r\n\r\n sharding?: \"hybrid\" | \"default\" | \"off\";\r\n /**\r\n * Persist store. (Default to MemoryStore thats not persis tho.)\r\n */\r\n store?: DBIStore;\r\n\r\n references?: {\r\n autoClear?: {\r\n check: number;\r\n ttl: number;\r\n }\r\n };\r\n\r\n strict?: boolean;\r\n}\r\n\r\nexport interface DBIRegisterAPI<TNamespace extends NamespaceEnums> {\r\n ChatInput(cfg: TDBIChatInputOmitted<TNamespace>): DBIChatInput<TNamespace>;\r\n ChatInputOptions: DBIChatInputOptions<TNamespace>;\r\n Event(cfg: TDBIEventOmitted<TNamespace>): DBIEvent<TNamespace>;\r\n Locale(cfg: TDBILocaleConstructor<TNamespace>): DBILocale<TNamespace>;\r\n Button(cfg: TDBIButtonOmitted<TNamespace>): DBIButton<TNamespace>;\r\n SelectMenu(cfg: TDBISelectMenuOmitted<TNamespace>): DBISelectMenu<TNamespace>;\r\n MessageContextMenu(cfg: TDBIMessageContextMenuOmitted<TNamespace>): DBIMessageContextMenu<TNamespace>;\r\n UserContextMenu(cfg: TDBIUserContextMenuOmitted<TNamespace>): DBIUserContextMenu<TNamespace>;\r\n InteractionLocale(cfg: TDBIInteractionLocaleOmitted): DBIInteractionLocale;\r\n Modal(cfg: TDBIModalOmitted<TNamespace>): DBIModal<TNamespace>;\r\n CustomEvent<T extends keyof NamespaceData[TNamespace][\"customEvents\"]>(cfg: TDBICustomEventOmitted<TNamespace, T>): DBICustomEvent<TNamespace, T>;\r\n onUnload(cb: () => Promise<any> | any): any;\r\n}\r\n\r\nexport class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string, any>> {\r\n namespace: TNamespace;\r\n config: DBIConfig;\r\n client: Discord.Client<true>;\r\n data: {\r\n interactions: Discord.Collection<string, TDBIInteractions<TNamespace>>;\r\n events: Discord.Collection<string, DBIEvent<TNamespace>>;\r\n locales: Discord.Collection<string, DBILocale<TNamespace>>;\r\n interactionLocales: Discord.Collection<string, DBIInteractionLocale>;\r\n other: TOtherData;\r\n eventMap: Record<string, string[] | { [k: string]: string }>;\r\n customEventNames: Set<string>;\r\n unloaders: Set<() => void>;\r\n registers: Set<(...args: any[]) => any>;\r\n registerUnloaders: Set<(...args: any[]) => any>;\r\n refs: Map<string, { at: number, value: any, ttl?: number }>;\r\n };\r\n events: Events<TNamespace>;\r\n cluster?: Sharding.Client;\r\n private _loaded: boolean;\r\n private _hooked: boolean;\r\n constructor(namespace: TNamespace, config: DBIConfigConstructor) {\r\n this.namespace = namespace as any;\r\n\r\n config.store = config.store as any || new MemoryStore();\r\n config.defaults = {\r\n locale: \"en\",\r\n defaultMemberPermissions: [],\r\n directMessages: false,\r\n ...(config.defaults || {})\r\n };\r\n config.sharding = config.sharding ?? \"off\";\r\n config.strict = config.strict ?? true;\r\n config.references = {\r\n autoClear: undefined,\r\n ...(config.references || {})\r\n }\r\n\r\n // @ts-ignore\r\n this.config = config;\r\n\r\n this.data = {\r\n interactions: new Discord.Collection(),\r\n events: new Discord.Collection(),\r\n locales: new Discord.Collection(),\r\n interactionLocales: new Discord.Collection(),\r\n other: {} as TOtherData,\r\n eventMap,\r\n customEventNames: new Set(),\r\n unloaders: new Set(),\r\n registers: new Set(),\r\n registerUnloaders: new Set(),\r\n refs: new Map()\r\n }\r\n\r\n this.events = new Events(this as any);\r\n this.client = new Discord.Client({\r\n ...(config.discord?.options || {}) as any,\r\n ...(config.sharding == \"hybrid\" ? {\r\n shards: (Sharding as any).data.SHARD_LIST,\r\n shardCount: (Sharding as any).data.TOTAL_SHARDS\r\n } : {})\r\n });\r\n this.cluster = config.sharding == \"hybrid\" ? new Sharding.Client(this.client) : undefined;\r\n this._loaded = false;\r\n this._hooked = false;\r\n }\r\n\r\n private async _hookListeners() {\r\n if (this._hooked) return;\r\n this._hooked = true;\r\n this.data.unloaders.add(hookInteractionListeners(this as any));\r\n this.data.unloaders.add(hookEventListeners(this as any));\r\n if (typeof this.config.references.autoClear != \"undefined\") {\r\n this.data.unloaders.add((() => {\r\n let interval = setInterval(() => {\r\n this.data.refs.forEach(({ at, ttl }, key) => {\r\n if (Date.now() > (at + (ttl || this.config.references.autoClear.ttl))) {\r\n this.data.refs.delete(key);\r\n }\r\n });\r\n }, this.config.references.autoClear.check);\r\n return () => {\r\n clearInterval(interval);\r\n }\r\n })());\r\n }\r\n }\r\n\r\n private async _unhookListeners() {\r\n if (!this._hooked) return;\r\n this._hooked = false;\r\n this.data.unloaders.forEach(f => {\r\n f();\r\n });\r\n }\r\n\r\n private async _unregisterAll() {\r\n for await (const cb of this.data.registerUnloaders) {\r\n await cb();\r\n }\r\n this.data.events.clear();\r\n this.data.interactions.clear();\r\n this.data.customEventNames.forEach((value) => {\r\n delete this.data.eventMap[value];\r\n });\r\n this.data.customEventNames.clear();\r\n }\r\n\r\n private async _registerAll() {\r\n const self = this;\r\n const ChatInputOptions = new DBIChatInputOptions(self);\r\n\r\n for await (const cb of this.data.registers) {\r\n let ChatInput = function (cfg: DBIChatInput<TNamespace>) {\r\n let dbiChatInput = new DBIChatInput(self, cfg);\r\n if (self.data.interactions.has(dbiChatInput.name)) throw new Error(`DBIChatInput \"${dbiChatInput.name}\" already loaded as \"${self.data.interactions.get(dbiChatInput.name)?.type}\"!`);\r\n self.data.interactions.set(dbiChatInput.name, dbiChatInput);\r\n return dbiChatInput;\r\n };\r\n ChatInput = Object.assign(ChatInput, class { constructor(...args: any[]) { return ChatInput.apply(this, args as any); } });\r\n\r\n let Event = function (cfg: TDBIEventOmitted<TNamespace>) {\r\n let dbiEvent = new DBIEvent(self as any, cfg);\r\n if (self.config.strict && self.data.events.has(dbiEvent.id || dbiEvent.name)) throw new Error(`DBIEvent \"${dbiEvent.id || dbiEvent.name}\" already loaded!`);\r\n self.data.events.set(dbiEvent.id || dbiEvent.name, dbiEvent);\r\n return dbiEvent;\r\n };\r\n Event = Object.assign(Event, class { constructor(...args: any[]) { return Event.apply(this, args as any); } });\r\n\r\n let Button = function (cfg: TDBIButtonOmitted<TNamespace>) {\r\n let dbiButton = new DBIButton(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiButton.name)) throw new Error(`DBIButton \"${dbiButton.name}\" already loaded as \"${self.data.interactions.get(dbiButton.name)?.type}\"!`);\r\n self.data.interactions.set(dbiButton.name, dbiButton as any);\r\n return dbiButton;\r\n };\r\n Button = Object.assign(Button, class { constructor(...args: any[]) { return Button.apply(this, args as any); } });\r\n\r\n let SelectMenu = function (cfg: TDBISelectMenuOmitted<TNamespace>) {\r\n let dbiSelectMenu = new DBISelectMenu(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiSelectMenu.name)) throw new Error(`DBISelectMenu \"${dbiSelectMenu.name}\" already loaded as \"${self.data.interactions.get(dbiSelectMenu.name)?.type}\"!`);\r\n self.data.interactions.set(dbiSelectMenu.name, dbiSelectMenu as any);\r\n return dbiSelectMenu;\r\n };\r\n SelectMenu = Object.assign(SelectMenu, class { constructor(...args: any[]) { return SelectMenu.apply(this, args as any); } });\r\n\r\n let MessageContextMenu = function (cfg: TDBIMessageContextMenuOmitted<TNamespace>) {\r\n let dbiMessageContextMenu = new DBIMessageContextMenu(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiMessageContextMenu.name)) throw new Error(`DBIMessageContextMenu \"${dbiMessageContextMenu.name}\" already loaded as \"${self.data.interactions.get(dbiMessageContextMenu.name)?.type}\"!`);\r\n self.data.interactions.set(dbiMessageContextMenu.name, dbiMessageContextMenu as any);\r\n return dbiMessageContextMenu;\r\n };\r\n MessageContextMenu = Object.assign(MessageContextMenu, class { constructor(...args: any[]) { return MessageContextMenu.apply(this, args as any); } });\r\n\r\n let UserContextMenu = function (cfg: TDBIUserContextMenuOmitted<TNamespace>) {\r\n let dbiUserContextMenu = new DBIUserContextMenu(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiUserContextMenu.name)) throw new Error(`DBIUserContextMenu \"${dbiUserContextMenu.name}\" already loaded as \"${self.data.interactions.get(dbiUserContextMenu.name)?.type}\"!`);\r\n self.data.interactions.set(dbiUserContextMenu.name, dbiUserContextMenu as any);\r\n return dbiUserContextMenu;\r\n };\r\n UserContextMenu = Object.assign(UserContextMenu, class { constructor(...args: any[]) { return UserContextMenu.apply(this, args as any); } });\r\n\r\n let Modal = function (cfg: TDBIModalOmitted<TNamespace>) {\r\n let dbiModal = new DBIModal(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiModal.name)) throw new Error(`DBIModal \"${dbiModal.name}\" already loaded as \"${self.data.interactions.get(dbiModal.name)?.type}\"!`);\r\n self.data.interactions.set(dbiModal.name, dbiModal as any);\r\n return dbiModal;\r\n };\r\n Modal = Object.assign(Modal, class { constructor(...args: any[]) { return Modal.apply(this, args as any); } });\r\n\r\n let Locale = function (cfg: TDBILocaleConstructor<TNamespace>) {\r\n let dbiLocale = new DBILocale(self as any, cfg);\r\n if (self.config.strict && self.data.interactionLocales.has(dbiLocale.name)) throw new Error(`DBILocale \"${dbiLocale.name}\" already loaded!`);\r\n if (self.data.locales.has(dbiLocale.name)) dbiLocale.mergeLocale(self.data.locales.get(dbiLocale.name));\r\n self.data.locales.set(dbiLocale.name, dbiLocale);\r\n return dbiLocale;\r\n };\r\n Locale = Object.assign(Locale, class { constructor(...args: any[]) { return Locale.apply(this, args as any); } });\r\n\r\n let CustomEvent = function (cfg: TDBICustomEventOmitted<TNamespace>) {\r\n let dbiCustomEvent = new DBICustomEvent(self, cfg) as any;\r\n if (self.config.strict && self.data.eventMap[dbiCustomEvent.name]) throw new Error(`DBICustomEvent \"${dbiCustomEvent.name}\" already loaded!`);\r\n self.data.eventMap[dbiCustomEvent.name] = dbiCustomEvent.map;\r\n self.data.customEventNames.add(dbiCustomEvent.name);\r\n return dbiCustomEvent;\r\n };\r\n CustomEvent = Object.assign(CustomEvent, class { constructor(...args: any[]) { return CustomEvent.apply(this, args as any); } });\r\n\r\n let InteractionLocale = function(cfg: TDBIInteractionLocaleOmitted) {\r\n let dbiInteractionLocale = new DBIInteractionLocale(self, cfg);\r\n if (self.config.strict && self.data.interactionLocales.has(dbiInteractionLocale.name)) throw new Error(`DBIInteractionLocale \"${dbiInteractionLocale.name}\" already loaded!`);\r\n self.data.interactionLocales.set(dbiInteractionLocale.name, dbiInteractionLocale);\r\n return dbiInteractionLocale;\r\n };\r\n InteractionLocale = Object.assign(InteractionLocale, class { constructor(...args: any[]) { return InteractionLocale.apply(this, args as any); } });\r\n\r\n await cb({\r\n ChatInput,\r\n Event,\r\n ChatInputOptions,\r\n Locale,\r\n Button,\r\n SelectMenu,\r\n MessageContextMenu,\r\n UserContextMenu,\r\n CustomEvent,\r\n Modal,\r\n InteractionLocale,\r\n onUnload(cb: () => Promise<any> | any) {\r\n self.data.registerUnloaders.add(cb);\r\n },\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * this.data.interactions.get(name)\r\n */\r\n interaction<TInteractionName extends keyof NamespaceData[TNamespace][\"interactionMapping\"]>(name: TInteractionName): NamespaceData[TNamespace][\"interactionMapping\"][TInteractionName] {\r\n return this.data.interactions.get(name as any) as any;\r\n }\r\n\r\n emit<TEventName extends keyof (NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)>(name: TEventName, args: (NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[TEventName] ): void {\r\n this.client.emit(name as any, { ...args, _DIRECT_: true } as any);\r\n }\r\n\r\n/**\r\n * \r\n * ((NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[K] as const)\r\n * typeof ((NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[K])[keyof typeof ((NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[K])]\r\n */\r\n\r\n /**\r\n * this.data.events.get(name)\r\n */\r\n event<TEventName extends NamespaceData[TNamespace][\"eventNames\"]>(name: TEventName): DBIEvent<TNamespace> {\r\n return this.data.events.get(name);\r\n }\r\n\r\n /**\r\n * this.data.locales.get(name)\r\n */\r\n locale<TLocaleName extends NamespaceData[TNamespace][\"localeNames\"]>(name: TLocaleName): DBILocale<TNamespace> {\r\n return this.data.locales.get(name) as any;\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n get<K extends keyof TOtherData>(k: K, defaultValue?: TOtherData[K]): TOtherData[K] {\r\n if (defaultValue && !this.has(k as any)) {\r\n this.set(k, defaultValue);\r\n return defaultValue;\r\n }\r\n return _.get(this.data.other, k);\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n set<K extends keyof TOtherData>(k: K, v: TOtherData[K]): any {\r\n this.data.other = _.set(this.data.other as any, k, v);\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n has(k: string): boolean {\r\n return _.has(this.data.other, k as any);\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n delete(k: string): boolean {\r\n return _.unset(this.data.other, k);\r\n }\r\n\r\n async login(): Promise<any> {\r\n await this.client.login(this.config.sharding == \"default\" ? undefined : this.config.discord.token);\r\n }\r\n\r\n async register(cb: (api: DBIRegisterAPI<TNamespace>) => void): Promise<any> {\r\n this.data.registers.add(cb);\r\n }\r\n\r\n async load(): Promise<boolean> {\r\n if (this._loaded) return false;\r\n await this._registerAll();\r\n await this._hookListeners();\r\n this._loaded = true;\r\n return true;\r\n }\r\n\r\n async unload(): Promise<boolean> {\r\n if (!this._loaded) return false;\r\n await this._unregisterAll();\r\n await this._unhookListeners();\r\n this._loaded = false;\r\n return true;\r\n }\r\n\r\n get loaded(): boolean {\r\n return this._loaded;\r\n }\r\n\r\n async publish(type: \"Global\", clear?: boolean): Promise<any>;\r\n async publish(type: \"Guild\", guildId: string, clear?: boolean): Promise<any>;\r\n\r\n async publish(...args: any[]) {\r\n let interactions = this.data.interactions.filter(i => i.type == \"ChatInput\" || i.type == \"MessageContextMenu\" || i.type == \"UserContextMenu\") as any;\r\n switch (args[0]) {\r\n case \"Global\": {\r\n return await publishInteractions(\r\n this.config.discord.token,\r\n args[1] ? new Discord.Collection() : interactions,\r\n this.data.interactionLocales,\r\n args[0]\r\n );\r\n }\r\n case \"Guild\": {\r\n return await publishInteractions(\r\n this.config.discord.token,\r\n args[2] ? new Discord.Collection() : interactions,\r\n this.data.interactionLocales,\r\n args[0],\r\n args[1]\r\n );\r\n }\r\n }\r\n }\r\n\r\n\r\n}"]}
|
|
1
|
+
{"version":3,"file":"DBI.js","sourceRoot":"","sources":["../src/DBI.ts"],"names":[],"mappings":";;;;AAAA,oEAAiC;AACjC,2DAAiF;AACjF,yEAAyE;AACzE,uEAAoE;AACpE,yCAAyE;AACzE,qDAAkD;AAClD,iFAA8E;AAC9E,qCAAkC;AAClC,2CAAoF;AACpF,2CAA8D;AAC9D,mDAA0E;AAC1E,mEAAkG;AAClG,6DAAyF;AACzF,qEAAkE;AAClE,iFAA4C;AAC5C,yCAA2D;AAC3D,0EAAoD;AACpD,4DAAuB;AACvB,iEAA+F;AAG/F,qDAA6E;AAmF7E,MAAa,GAAG;IACd,SAAS,CAAa;IACtB,MAAM,CAAY;IAClB,MAAM,CAAuB;IAC7B,IAAI,CAYF;IACF,MAAM,CAAqB;IAC3B,OAAO,CAAmB;IAClB,OAAO,CAAU;IACjB,OAAO,CAAU;IACzB,YAAY,SAAqB,EAAE,MAA4B;QAC7D,IAAI,CAAC,SAAS,GAAG,SAAgB,CAAC;QAElC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAY,IAAI,IAAI,yBAAW,EAAE,CAAC;QACxD,MAAM,CAAC,QAAQ,GAAG;YAChB,MAAM,EAAE,IAAI;YACZ,wBAAwB,EAAE,EAAE;YAC5B,cAAc,EAAE,KAAK;YACrB,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;SAC3B,CAAC;QACF,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC;QAC3C,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;QACtC,MAAM,CAAC,UAAU,GAAG;YAClB,SAAS,EAAE,SAAS;YACpB,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAA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ACb,OAAO,MAAM,IAAA,yCAAmB,EAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EACzB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,oBAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,EACjD,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAC5B,IAAI,CAAC,CAAC,CAAC,CACR,CAAC;aACH;YACD,KAAK,OAAO,CAAC,CAAC;gBACZ,OAAO,MAAM,IAAA,yCAAmB,EAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EACzB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,oBAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,EACjD,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAC5B,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,CACR,CAAC;aACH;SACF;IACH,CAAC;CAGF;AA7UD,kBA6UC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBIChatInput, TDBIChatInputOmitted } from \"./types/ChatInput/ChatInput\";\r\nimport { DBIChatInputOptions } from \"./types/ChatInput/ChatInputOptions\";\r\nimport { publishInteractions } from \"./methods/publishInteractions\";\r\nimport { ClientEvents, DBIEvent, TDBIEventOmitted } from \"./types/Event\";\r\nimport { MemoryStore } from \"./utils/MemoryStore\";\r\nimport { hookInteractionListeners } from \"./methods/hookInteractionListeners\";\r\nimport { Events } from \"./Events\";\r\nimport { DBILocale, TDBILocaleConstructor, TDBILocaleString } from \"./types/Locale\";\r\nimport { DBIButton, TDBIButtonOmitted } from \"./types/Button\";\r\nimport { DBISelectMenu, TDBISelectMenuOmitted } from \"./types/SelectMenu\";\r\nimport { DBIMessageContextMenu, TDBIMessageContextMenuOmitted } from \"./types/MessageContextMenu\";\r\nimport { DBIUserContextMenu, TDBIUserContextMenuOmitted } from \"./types/UserContextMenu\";\r\nimport { hookEventListeners } from \"./methods/hookEventListeners\";\r\nimport eventMap from \"./data/eventMap.json\";\r\nimport { DBIModal, TDBIModalOmitted } from \"./types/Modal\";\r\nimport * as Sharding from \"discord-hybrid-sharding\";\r\nimport _ from \"lodash\";\r\nimport { DBIInteractionLocale, TDBIInteractionLocaleOmitted } from \"./types/InteractionLocale\";\r\nimport { TDBIInteractions } from \"./types/Interaction\";\r\nimport { NamespaceData, NamespaceEnums } from \"../generated/namespaceData\";\r\nimport { DBICustomEvent, TDBICustomEventOmitted } from \"./types/CustomEvent\";\r\n\r\nexport interface DBIStore {\r\n get(key: string, defaultValue?: any): Promise<any>;\r\n set(key: string, value: any): Promise<void>;\r\n delete(key: string): Promise<void>;\r\n has(key: string): Promise<boolean>;\r\n}\r\n\r\nexport interface DBIConfig {\r\n discord: {\r\n token: string;\r\n options: Discord.ClientOptions\r\n }\r\n defaults: {\r\n locale: TDBILocaleString,\r\n directMessages: boolean,\r\n defaultMemberPermissions: Discord.PermissionsString[]\r\n };\r\n\r\n sharding: \"hybrid\" | \"default\" | \"off\";\r\n /**\r\n * Persist store. (Default to MemoryStore thats not persis tho.)\r\n */\r\n store: DBIStore;\r\n\r\n references: {\r\n autoClear?: {\r\n check: number;\r\n ttl: number;\r\n }\r\n };\r\n\r\n strict: boolean;\r\n}\r\n\r\nexport interface DBIConfigConstructor {\r\n discord: {\r\n token: string;\r\n options: Discord.ClientOptions\r\n }\r\n defaults?: {\r\n locale?: TDBILocaleString,\r\n directMessages?: boolean,\r\n defaultMemberPermissions?: Discord.PermissionsString[]\r\n };\r\n\r\n sharding?: \"hybrid\" | \"default\" | \"off\";\r\n /**\r\n * Persist store. (Default to MemoryStore thats not persis tho.)\r\n */\r\n store?: DBIStore;\r\n\r\n references?: {\r\n autoClear?: {\r\n check: number;\r\n ttl: number;\r\n }\r\n };\r\n\r\n data?: {\r\n other?: Record<string, any>;\r\n refs?: Map<string, { at: number, value: any, ttl?: number }>;\r\n }\r\n\r\n strict?: boolean;\r\n}\r\n\r\nexport interface DBIRegisterAPI<TNamespace extends NamespaceEnums> {\r\n ChatInput(cfg: TDBIChatInputOmitted<TNamespace>): DBIChatInput<TNamespace>;\r\n ChatInputOptions: DBIChatInputOptions<TNamespace>;\r\n Event(cfg: TDBIEventOmitted<TNamespace>): DBIEvent<TNamespace>;\r\n Locale(cfg: TDBILocaleConstructor<TNamespace>): DBILocale<TNamespace>;\r\n Button(cfg: TDBIButtonOmitted<TNamespace>): DBIButton<TNamespace>;\r\n SelectMenu(cfg: TDBISelectMenuOmitted<TNamespace>): DBISelectMenu<TNamespace>;\r\n MessageContextMenu(cfg: TDBIMessageContextMenuOmitted<TNamespace>): DBIMessageContextMenu<TNamespace>;\r\n UserContextMenu(cfg: TDBIUserContextMenuOmitted<TNamespace>): DBIUserContextMenu<TNamespace>;\r\n InteractionLocale(cfg: TDBIInteractionLocaleOmitted): DBIInteractionLocale;\r\n Modal(cfg: TDBIModalOmitted<TNamespace>): DBIModal<TNamespace>;\r\n CustomEvent<T extends keyof NamespaceData[TNamespace][\"customEvents\"]>(cfg: TDBICustomEventOmitted<TNamespace, T>): DBICustomEvent<TNamespace, T>;\r\n onUnload(cb: () => Promise<any> | any): any;\r\n}\r\n\r\nexport class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string, any>> {\r\n namespace: TNamespace;\r\n config: DBIConfig;\r\n client: Discord.Client<true>;\r\n data: {\r\n interactions: Discord.Collection<string, TDBIInteractions<TNamespace>>;\r\n events: Discord.Collection<string, DBIEvent<TNamespace>>;\r\n locales: Discord.Collection<string, DBILocale<TNamespace>>;\r\n interactionLocales: Discord.Collection<string, DBIInteractionLocale>;\r\n other: TOtherData;\r\n eventMap: Record<string, string[] | { [k: string]: string }>;\r\n customEventNames: Set<string>;\r\n unloaders: Set<() => void>;\r\n registers: Set<(...args: any[]) => any>;\r\n registerUnloaders: Set<(...args: any[]) => any>;\r\n refs: Map<string, { at: number, value: any, ttl?: number }>;\r\n };\r\n events: Events<TNamespace>;\r\n cluster?: Sharding.Client;\r\n private _loaded: boolean;\r\n private _hooked: boolean;\r\n constructor(namespace: TNamespace, config: DBIConfigConstructor) {\r\n this.namespace = namespace as any;\r\n\r\n config.store = config.store as any || new MemoryStore();\r\n config.defaults = {\r\n locale: \"en\",\r\n defaultMemberPermissions: [],\r\n directMessages: false,\r\n ...(config.defaults || {})\r\n };\r\n config.sharding = config.sharding ?? \"off\";\r\n config.strict = config.strict ?? true;\r\n config.references = {\r\n autoClear: undefined,\r\n ...(config.references || {})\r\n }\r\n\r\n // @ts-ignore\r\n this.config = config;\r\n\r\n this.data = {\r\n interactions: new Discord.Collection(),\r\n events: new Discord.Collection(),\r\n locales: new Discord.Collection(),\r\n interactionLocales: new Discord.Collection(),\r\n other: (config.data?.other as any) ?? ({} as TOtherData),\r\n eventMap,\r\n customEventNames: new Set(),\r\n unloaders: new Set(),\r\n registers: new Set(),\r\n registerUnloaders: new Set(),\r\n refs: config.data?.refs ?? new Map()\r\n }\r\n\r\n this.events = new Events(this as any);\r\n this.client = new Discord.Client({\r\n ...(config.discord?.options || {}) as any,\r\n ...(config.sharding == \"hybrid\" ? {\r\n shards: (Sharding as any).data.SHARD_LIST,\r\n shardCount: (Sharding as any).data.TOTAL_SHARDS\r\n } : {})\r\n });\r\n this.cluster = config.sharding == \"hybrid\" ? new Sharding.Client(this.client) : undefined;\r\n this._loaded = false;\r\n this._hooked = false;\r\n }\r\n\r\n private async _hookListeners() {\r\n if (this._hooked) return;\r\n this._hooked = true;\r\n this.data.unloaders.add(hookInteractionListeners(this as any));\r\n this.data.unloaders.add(hookEventListeners(this as any));\r\n if (typeof this.config.references.autoClear != \"undefined\") {\r\n this.data.unloaders.add((() => {\r\n let interval = setInterval(() => {\r\n this.data.refs.forEach(({ at, ttl }, key) => {\r\n if (Date.now() > (at + (ttl || this.config.references.autoClear.ttl))) {\r\n this.data.refs.delete(key);\r\n }\r\n });\r\n }, this.config.references.autoClear.check);\r\n return () => {\r\n clearInterval(interval);\r\n }\r\n })());\r\n }\r\n }\r\n\r\n private async _unhookListeners() {\r\n if (!this._hooked) return;\r\n this._hooked = false;\r\n this.data.unloaders.forEach(f => {\r\n f();\r\n });\r\n }\r\n\r\n private async _unregisterAll() {\r\n for await (const cb of this.data.registerUnloaders) {\r\n await cb();\r\n }\r\n this.data.events.clear();\r\n this.data.interactions.clear();\r\n this.data.customEventNames.forEach((value) => {\r\n delete this.data.eventMap[value];\r\n });\r\n this.data.customEventNames.clear();\r\n }\r\n\r\n private async _registerAll() {\r\n const self = this;\r\n const ChatInputOptions = new DBIChatInputOptions(self);\r\n\r\n for await (const cb of this.data.registers) {\r\n let ChatInput = function (cfg: DBIChatInput<TNamespace>) {\r\n let dbiChatInput = new DBIChatInput(self, cfg);\r\n if (self.data.interactions.has(dbiChatInput.name)) throw new Error(`DBIChatInput \"${dbiChatInput.name}\" already loaded as \"${self.data.interactions.get(dbiChatInput.name)?.type}\"!`);\r\n self.data.interactions.set(dbiChatInput.name, dbiChatInput);\r\n return dbiChatInput;\r\n };\r\n ChatInput = Object.assign(ChatInput, class { constructor(...args: any[]) { return ChatInput.apply(this, args as any); } });\r\n\r\n let Event = function (cfg: TDBIEventOmitted<TNamespace>) {\r\n let dbiEvent = new DBIEvent(self as any, cfg);\r\n if (self.config.strict && self.data.events.has(dbiEvent.id || dbiEvent.name)) throw new Error(`DBIEvent \"${dbiEvent.id || dbiEvent.name}\" already loaded!`);\r\n self.data.events.set(dbiEvent.id || dbiEvent.name, dbiEvent);\r\n return dbiEvent;\r\n };\r\n Event = Object.assign(Event, class { constructor(...args: any[]) { return Event.apply(this, args as any); } });\r\n\r\n let Button = function (cfg: TDBIButtonOmitted<TNamespace>) {\r\n let dbiButton = new DBIButton(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiButton.name)) throw new Error(`DBIButton \"${dbiButton.name}\" already loaded as \"${self.data.interactions.get(dbiButton.name)?.type}\"!`);\r\n self.data.interactions.set(dbiButton.name, dbiButton as any);\r\n return dbiButton;\r\n };\r\n Button = Object.assign(Button, class { constructor(...args: any[]) { return Button.apply(this, args as any); } });\r\n\r\n let SelectMenu = function (cfg: TDBISelectMenuOmitted<TNamespace>) {\r\n let dbiSelectMenu = new DBISelectMenu(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiSelectMenu.name)) throw new Error(`DBISelectMenu \"${dbiSelectMenu.name}\" already loaded as \"${self.data.interactions.get(dbiSelectMenu.name)?.type}\"!`);\r\n self.data.interactions.set(dbiSelectMenu.name, dbiSelectMenu as any);\r\n return dbiSelectMenu;\r\n };\r\n SelectMenu = Object.assign(SelectMenu, class { constructor(...args: any[]) { return SelectMenu.apply(this, args as any); } });\r\n\r\n let MessageContextMenu = function (cfg: TDBIMessageContextMenuOmitted<TNamespace>) {\r\n let dbiMessageContextMenu = new DBIMessageContextMenu(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiMessageContextMenu.name)) throw new Error(`DBIMessageContextMenu \"${dbiMessageContextMenu.name}\" already loaded as \"${self.data.interactions.get(dbiMessageContextMenu.name)?.type}\"!`);\r\n self.data.interactions.set(dbiMessageContextMenu.name, dbiMessageContextMenu as any);\r\n return dbiMessageContextMenu;\r\n };\r\n MessageContextMenu = Object.assign(MessageContextMenu, class { constructor(...args: any[]) { return MessageContextMenu.apply(this, args as any); } });\r\n\r\n let UserContextMenu = function (cfg: TDBIUserContextMenuOmitted<TNamespace>) {\r\n let dbiUserContextMenu = new DBIUserContextMenu(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiUserContextMenu.name)) throw new Error(`DBIUserContextMenu \"${dbiUserContextMenu.name}\" already loaded as \"${self.data.interactions.get(dbiUserContextMenu.name)?.type}\"!`);\r\n self.data.interactions.set(dbiUserContextMenu.name, dbiUserContextMenu as any);\r\n return dbiUserContextMenu;\r\n };\r\n UserContextMenu = Object.assign(UserContextMenu, class { constructor(...args: any[]) { return UserContextMenu.apply(this, args as any); } });\r\n\r\n let Modal = function (cfg: TDBIModalOmitted<TNamespace>) {\r\n let dbiModal = new DBIModal(self as any, cfg);\r\n if (self.config.strict && self.data.interactions.has(dbiModal.name)) throw new Error(`DBIModal \"${dbiModal.name}\" already loaded as \"${self.data.interactions.get(dbiModal.name)?.type}\"!`);\r\n self.data.interactions.set(dbiModal.name, dbiModal as any);\r\n return dbiModal;\r\n };\r\n Modal = Object.assign(Modal, class { constructor(...args: any[]) { return Modal.apply(this, args as any); } });\r\n\r\n let Locale = function (cfg: TDBILocaleConstructor<TNamespace>) {\r\n let dbiLocale = new DBILocale(self as any, cfg);\r\n if (self.config.strict && self.data.interactionLocales.has(dbiLocale.name)) throw new Error(`DBILocale \"${dbiLocale.name}\" already loaded!`);\r\n if (self.data.locales.has(dbiLocale.name)) dbiLocale.mergeLocale(self.data.locales.get(dbiLocale.name));\r\n self.data.locales.set(dbiLocale.name, dbiLocale);\r\n return dbiLocale;\r\n };\r\n Locale = Object.assign(Locale, class { constructor(...args: any[]) { return Locale.apply(this, args as any); } });\r\n\r\n let CustomEvent = function (cfg: TDBICustomEventOmitted<TNamespace>) {\r\n let dbiCustomEvent = new DBICustomEvent(self, cfg) as any;\r\n if (self.config.strict && self.data.eventMap[dbiCustomEvent.name]) throw new Error(`DBICustomEvent \"${dbiCustomEvent.name}\" already loaded!`);\r\n self.data.eventMap[dbiCustomEvent.name] = dbiCustomEvent.map;\r\n self.data.customEventNames.add(dbiCustomEvent.name);\r\n return dbiCustomEvent;\r\n };\r\n CustomEvent = Object.assign(CustomEvent, class { constructor(...args: any[]) { return CustomEvent.apply(this, args as any); } });\r\n\r\n let InteractionLocale = function(cfg: TDBIInteractionLocaleOmitted) {\r\n let dbiInteractionLocale = new DBIInteractionLocale(self, cfg);\r\n if (self.config.strict && self.data.interactionLocales.has(dbiInteractionLocale.name)) throw new Error(`DBIInteractionLocale \"${dbiInteractionLocale.name}\" already loaded!`);\r\n self.data.interactionLocales.set(dbiInteractionLocale.name, dbiInteractionLocale);\r\n return dbiInteractionLocale;\r\n };\r\n InteractionLocale = Object.assign(InteractionLocale, class { constructor(...args: any[]) { return InteractionLocale.apply(this, args as any); } });\r\n\r\n await cb({\r\n ChatInput,\r\n Event,\r\n ChatInputOptions,\r\n Locale,\r\n Button,\r\n SelectMenu,\r\n MessageContextMenu,\r\n UserContextMenu,\r\n CustomEvent,\r\n Modal,\r\n InteractionLocale,\r\n onUnload(cb: () => Promise<any> | any) {\r\n self.data.registerUnloaders.add(cb);\r\n },\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * this.data.interactions.get(name)\r\n */\r\n interaction<TInteractionName extends keyof NamespaceData[TNamespace][\"interactionMapping\"]>(name: TInteractionName): NamespaceData[TNamespace][\"interactionMapping\"][TInteractionName] {\r\n return this.data.interactions.get(name as any) as any;\r\n }\r\n\r\n emit<TEventName extends keyof (NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)>(name: TEventName, args: (NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[TEventName] ): void {\r\n this.client.emit(name as any, { ...args, _DIRECT_: true } as any);\r\n }\r\n\r\n/**\r\n * \r\n * ((NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[K] as const)\r\n * typeof ((NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[K])[keyof typeof ((NamespaceData[TNamespace][\"customEvents\"] & ClientEvents)[K])]\r\n */\r\n\r\n /**\r\n * this.data.events.get(name)\r\n */\r\n event<TEventName extends NamespaceData[TNamespace][\"eventNames\"]>(name: TEventName): DBIEvent<TNamespace> {\r\n return this.data.events.get(name);\r\n }\r\n\r\n /**\r\n * this.data.locales.get(name)\r\n */\r\n locale<TLocaleName extends NamespaceData[TNamespace][\"localeNames\"]>(name: TLocaleName): DBILocale<TNamespace> {\r\n return this.data.locales.get(name) as any;\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n get<K extends keyof TOtherData>(k: K, defaultValue?: TOtherData[K]): TOtherData[K] {\r\n if (defaultValue && !this.has(k as any)) {\r\n this.set(k, defaultValue);\r\n return defaultValue;\r\n }\r\n return _.get(this.data.other, k);\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n set<K extends keyof TOtherData>(k: K, v: TOtherData[K]): any {\r\n this.data.other = _.set(this.data.other as any, k, v);\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n has(k: string): boolean {\r\n return _.has(this.data.other, k as any);\r\n }\r\n\r\n /**\r\n * Shorthands for modifying `dbi.data.other`\r\n */\r\n delete(k: string): boolean {\r\n return _.unset(this.data.other, k);\r\n }\r\n\r\n async login(): Promise<any> {\r\n await this.client.login(this.config.sharding == \"default\" ? undefined : this.config.discord.token);\r\n }\r\n\r\n async register(cb: (api: DBIRegisterAPI<TNamespace>) => void): Promise<any> {\r\n this.data.registers.add(cb);\r\n }\r\n\r\n async load(): Promise<boolean> {\r\n if (this._loaded) return false;\r\n await this._registerAll();\r\n await this._hookListeners();\r\n this._loaded = true;\r\n return true;\r\n }\r\n\r\n async unload(): Promise<boolean> {\r\n if (!this._loaded) return false;\r\n await this._unregisterAll();\r\n await this._unhookListeners();\r\n this._loaded = false;\r\n return true;\r\n }\r\n\r\n get loaded(): boolean {\r\n return this._loaded;\r\n }\r\n\r\n async publish(type: \"Global\", clear?: boolean): Promise<any>;\r\n async publish(type: \"Guild\", guildId: string, clear?: boolean): Promise<any>;\r\n\r\n async publish(...args: any[]) {\r\n let interactions = this.data.interactions.filter(i => i.type == \"ChatInput\" || i.type == \"MessageContextMenu\" || i.type == \"UserContextMenu\") as any;\r\n switch (args[0]) {\r\n case \"Global\": {\r\n return await publishInteractions(\r\n this.config.discord.token,\r\n args[1] ? new Discord.Collection() : interactions,\r\n this.data.interactionLocales,\r\n args[0]\r\n );\r\n }\r\n case \"Guild\": {\r\n return await publishInteractions(\r\n this.config.discord.token,\r\n args[2] ? new Discord.Collection() : interactions,\r\n this.data.interactionLocales,\r\n args[0],\r\n args[1]\r\n );\r\n }\r\n }\r\n }\r\n\r\n\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishInteractions.d.ts","sourceRoot":"","sources":["../../src/methods/publishInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAM5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,EACtE,mBAAmB,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACrE,WAAW,EAAE,OAAO,GAAG,QAAQ,EAC/B,OAAO,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"publishInteractions.d.ts","sourceRoot":"","sources":["../../src/methods/publishInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAM5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,EACtE,mBAAmB,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACrE,WAAW,EAAE,OAAO,GAAG,QAAQ,EAC/B,OAAO,CAAC,EAAE,MAAM,iBAqKjB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,GAAG,GAAG,EAAE,CAcvE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,GAAG,CAgD9D"}
|