Skip to content

Discord Package Entry Point (index.ts)

This file serves as the main entry point for the @sodacore/core Discord integration package. It re-exports all primary decorators, services, providers, helpers, scripts, and types, making them available for import from a single location. The default export is the DiscordPlugin for easy integration with the Sodacore application.


Features

  • Centralized Exports: Exposes all Discord-related decorators, services, providers, helpers, and scripts for easy import.
  • Decorator Exports: Provides decorators for Discord commands, context menus, events, handlers, and parameter injection.
  • Service and Provider Exports: Exports the main Discord service, OAuth provider, prompts helper, and slash commands provider.
  • Script Exports: Exports CLI scripts for managing Discord commands.
  • Type Exports: Exports the main Discord configuration type for strong typing.
  • Default Plugin Export: Exports DiscordPlugin as the default, enabling quick registration with the Sodacore application.

Usage

Import Discord integration features directly from the package root:

typescript
import DiscordPlugin, {
	Command,
	ContextMenu,
	Event,
	Handler,
	Channel,
	Client,
	Field,
	Guild,
	Interaction,
	Option,
	Query,
	User,
	DiscordService,
	OAuthProvider,
	PromptsHelper,
	SlashCommandsProvider,
	DiscordScripts,
	IConfig,
} from '@sodacore/core/discord';

Register the plugin with your Sodacore application:

typescript
import DiscordPlugin from '@sodacore/core/discord';
app.register(DiscordPlugin);

API

Default Export

  • DiscordPlugin The main plugin class for integrating Discord functionality with the Sodacore application.

Named Exports

  • Decorators:

    • Add (context menu decorators)
    • Auth (authorization decorators)
    • Command, ContextMenu, Event, Handler (controller decorators)
    • Channel, Client, Field, Guild, Interaction, Option, Query, User (parameter decorators)
    • On (event handler decorators)
  • Services & Providers:

    • DiscordService
    • OAuthProvider
    • PromptsHelper
    • SlashCommandsProvider
  • Scripts:

    • DiscordScripts (CLI scripts for command management)
  • Discord.js Utilities:

    • GatewayIntentBits
    • SlashCommandBuilder
  • Types:

    • IConfig (Discord configuration type)

Notes

  • This file is intended to be the single import point for all Discord integration features in the Sodacore ecosystem.
  • All exports are organized for clarity and ease of use, supporting both application and library development.
  • Type exports ensure strong typing and IntelliSense support in TypeScript projects.

Released under the Apache-2.0 License.