Skip to content

Extension APIs

The global types are available here. Read the comments for more information. What globals you can use depends on the current environment:

  • moonlight: available in the web environment (index.ts, Webpack modules)
    • Contains patching and Webpack module information, the API level, localStorage, LunAST, moonmap
  • moonlightNode: available in the web and Node.js environments
    • Contains configuration details, browser checks
    • Polyfilled in the browser extension
  • moonlightNodeSandboxed: available in the host and Node.js environments (host.ts, node.ts)
    • Contains filesystem APIs
  • moonlightHost: available in the host environment (host.ts)
    • Contains configuration details, .asar path

These libraries are built into moonlight as core extensions. See here for an example on using them.

Add custom “app panels” next to the user area and mute buttons.

  • Module ID: appPanels_appPanels
  • Types: here

Register slash commands and perform text manipulation.

  • Module ID: commands_commands
  • Types: here

Provides a custom error boundary component, utility for creating icons, and re-exports of Flux stores.

  • Module IDs: common_ErrorBoundary, common_icons, common_stores
  • Types: here

Add custom elements to commonly edited components.

  • Module IDs: componentEditor_dmList, componentEditor_memberList, componentEditor_messages
  • Types: here

Create additional items on existing context menus.

  • Module ID: contextMenu_contextMenu
  • Types: here

Register custom Markdown rules for rendering chat messages.

  • Module ID: markdown_markdown
  • Types: here

Add banners (known as “notices”) to the top of the client window.

  • Module ID: notices_notices
  • Types: here

Add custom entries to Discord’s settings page.

  • Module ID: settings_settings
  • Types: here

Find and inspect existing Webpack modules.

  • Module ID: spacepack_spacepack
  • Types: here