Orginize
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Standalone pack binding. Must be a **static** import from
|
||||
* `bare-os-standalone-pack-imports.mjs` / `standalone.mjs` so bare-pack
|
||||
* rewrites `discord.js` into app.bundle. Do not load this from file:/pear
|
||||
* checkouts (use vendored bare-discord-js via createRequire).
|
||||
*/
|
||||
import discord from 'discord.js'
|
||||
import { registerPackedDiscordJs } from './bare-os-ctx-discord-registry.js'
|
||||
|
||||
function unwrap(mod) {
|
||||
if (mod && typeof mod.Client === 'function') return mod
|
||||
const def = mod && mod.default
|
||||
if (def && typeof def.Client === 'function') return def
|
||||
return null
|
||||
}
|
||||
|
||||
function applyShims(d) {
|
||||
if (!d || typeof d !== 'object') return d
|
||||
const events = d.Events
|
||||
if (events && events.ClientReady && events.Ready == null) {
|
||||
events.Ready = events.ClientReady
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
export const bareDiscordJs = registerPackedDiscordJs(applyShims(unwrap(discord)))
|
||||
export default bareDiscordJs
|
||||
Reference in New Issue
Block a user