Skip to content

Extension APIs

moonlight globals

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

Extension libraries

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

App Panels

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

  • Module ID: appPanels_appPanels
  • Types: here

Commands

Register slash commands and perform text manipulation.

  • Module ID: commands_commands
  • Types: here

Common

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

Component Editor

Add custom elements to commonly edited components.

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

Context Menu

Create additional items on existing context menus.

  • Module ID: contextMenu_contextMenu
  • Types: here

Markdown

Register custom Markdown rules for rendering chat messages.

  • Module ID: markdown_markdown
  • Types: here

Notices

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

  • Module ID: notices_notices
  • Types: here

Settings

Add custom entries to Discord’s settings page.

  • Module ID: settings_settings
  • Types: here

Spacepack

Find and inspect existing Webpack modules.

  • Module ID: spacepack_spacepack
  • Types: here