nyx Typedoc
    Preparing search index...

    Module @nyx-discord/base - v1.1.0

    @nyx-discord/base


    @nyx-discord/base is the foundation of nyx. It holds the interfaces every nyx component follows, plus default implementations of them, without depending on any Discord library.

    Tip

    Building a bot? You don't need to install this package directly. Install the adapter for your library, which re-exports everything from here:

    If your bot... Install
    Uses discord.js @nyx-discord/djs
    Uses @discordjs/core @nyx-discord/djs-core
    Receives interactions over HTTP @nyx-discord/http

    Every part of nyx (command manager, resolver, deployer, event dispatcher, error handler...) is an interface with a default implementation, so you can replace any of them with your own. You can tell them apart by their names:

    Name Meaning
    No prefix (CommandManager) An interface: what a component does, and what the rest of nyx expects.
    Abstract* (AbstractSchedule) Needs to be extended to be used, like your own commands, subscribers and schedules.
    Basic* (BasicEventBus) A complete, simple implementation. Use it directly, or extend it.
    Default* (DefaultCommandManager) The implementation the bot uses internally. Extend it and inject your version.
    Base* (BaseCommand) A library-agnostic foundation that the adapters build on.

    📦 Entry points

    Import Contains
    @nyx-discord/base Everything.
    @nyx-discord/base/types Only the interfaces.
    @nyx-discord/base/defaults Only the implementations.

    If you're writing a plugin or library for nyx, depend on @nyx-discord/base instead of an adapter, so it works with all of them. Importing from @nyx-discord/base/types makes it impossible to accidentally depend on an implementation:

    import type { NyxBot, NyxPlugin } from '@nyx-discord/base/types';

    export class MyPlugin implements NyxPlugin {
    public static readonly Id = Symbol('my-plugin');

    public async onRegister(bot: NyxBot) {
    // add commands, subscribers and schedules to the bot
    }

    public async onUnregister(bot: NyxBot) {
    // remove them
    }

    public getData() {
    return { name: 'my-plugin', version: '1.0.0', description: 'Does something useful' };
    }

    public getId() {
    return MyPlugin.Id;
    }
    }
    AbstractBusSubscriber
    AbstractCustomIdCodec
    AbstractEventDispatcher
    AbstractEventSubscriber
    AbstractEventSubscriberFilter
    AbstractEventSubscriberMiddleware
    AbstractFilter
    AbstractFilterAggregator
    AbstractMiddleware
    AbstractMiddlewareList
    AbstractPluginSubscriber
    AbstractSchedule
    AbstractScheduleFilter
    AbstractScheduleMiddleware
    AbstractScheduleSubscriber
    AbstractServiceSubscriber
    AndFilter
    AssertionError
    BaseBot
    BaseChildableCommand
    BaseClientSubscriber
    BaseCommand
    BaseCommandFilter
    BaseCommandMiddleware
    BaseCommandSubscriber
    BaseContextMenuCommand
    BaseExecutableCommand
    BaseParentCommand
    BaseStandaloneCommand
    BaseSubCommand
    BaseSubCommandGroup
    BasicAsyncEventDispatcher
    BasicErrorHandler
    BasicEventBus
    BasicEventEmitterBus
    BasicFilterCheckMiddleware
    BasicSyncEventDispatcher
    CommandAutocompleteError
    CommandError
    CommandFilterCheckMiddleware
    CommandMiddlewareError
    CommandMiddlewareList
    CronJobAdapter
    DefaultBotService
    DefaultCommandCustomIdCodec
    DefaultCommandRepository
    DefaultMetadataFactory
    DefaultPluginManager
    DefaultScheduleExecutionScheduler
    DefaultScheduleExecutor
    DefaultScheduleManager
    DefaultScheduleRepository
    EventSubscriberMiddlewareError
    FalseFilter
    FeatureError
    HandleCheckEventMiddleware
    IllegalDuplicateError
    IllegalStateError
    LifetimeCheckEventMiddleware
    NotFilter
    NotImplementedError
    ObjectNotFoundError
    OrFilter
    PluginAddError
    ProtectedObjectError
    ScheduleFilterCheckMiddleware
    ScheduleMiddlewareError
    ScheduleMiddlewareList
    SubscriberCallbackWrapper
    SubscriberFilterCheckMiddleware
    SubscriberMiddlewareList
    TimerJobAdapter
    TrueFilter
    UncaughtCommandMiddlewareError
    UncaughtEventSubscriberMiddlewareError
    UncaughtScheduleMiddlewareError
    AsyncEventDispatcher
    BotLifecycleObserver
    BotOptions
    BotService
    BotServiceEventArgs
    ChatExecutableCommand
    ChildableCommand
    ChildCommand
    Command
    CommandCustomIdCodec
    CommandDeployer
    CommandErrorHandler
    CommandEventArgs
    CommandExecutor
    CommandFilter
    CommandManager
    CommandMiddleware
    CommandRepository
    CommandResolver
    CommandSubscriptionsContainer
    ContextMenuCommand
    CustomIdCodec
    ErrorHandler
    ErrorHandlerContainer
    EventBus
    EventBusEventArgs
    EventDispatcher
    EventEmitterBus
    EventEmitterLike
    EventSubscriber
    EventSubscriberErrorHandler
    EventSubscriberFilter
    EventSubscriberMiddleware
    ExecutableCommand
    Filter
    Filterable
    Identifiable
    InteractionTypes
    Metadatable
    MetadataFactory
    Middleware
    MiddlewareList
    MiddlewareListContainer
    Nameable
    NyxBot
    NyxClient
    NyxLogger
    NyxPlugin
    ParentCommand
    PluginEventArgs
    PluginManager
    PriorityAware
    Protectable
    ReadonlyCommandRepository
    ReadonlyScheduleExecutionScheduler
    ReadonlyScheduleRepository
    Schedule
    ScheduleErrorHandler
    ScheduleEventArgs
    ScheduleExecutionScheduler
    ScheduleExecutor
    ScheduleFilter
    ScheduleJobAdapter
    ScheduleManager
    ScheduleMiddleware
    ScheduleRepository
    StandaloneCommand
    SubCommand
    SubCommandGroup
    SyncEventDispatcher
    UndestroyableScheduleJobAdapter
    AnyClass
    AnyEventBus
    AnyEventSubscriber
    AnyEventSubscriberFrom
    AnyExecutableCommand
    ApplicationCommandCollection
    ApplicationCommandInteraction
    Awaitable
    BotServiceEvent
    BotStatus
    ClassImplements
    CommandCustomIdData
    CommandEvent
    CommandExecutableInteraction
    CommandExecutionArgs
    CommandFilterResolvable
    CommandMiddlewareResolvable
    CommandResolvableInteraction
    Comparator
    ComponentCommandInteraction
    Constructor
    DefaultScheduleJob
    ErrorConsumer
    ErrorConsumerCollection
    EventBusEvent
    EventDispatchArgs
    EventSubscriberCollection
    EventSubscriberFilterResolvable
    EventSubscriberLifetime
    EventSubscriberMiddlewareResolvable
    FilterResolvable
    FilterResolvableFrom
    Identifier
    ImplementsParentCommand
    ImplementsStandaloneCommand
    ImplementsSubCommand
    ImplementsSubCommandGroup
    InjectableBotDependencies
    Metadata
    MiddlewareResolvable
    MiddlewareResolvableFrom
    MiddlewareResponse
    NyxPluginData
    PluginEvent
    Priority
    ReadonlyCollectionFrom
    ReadonlyCommandDeployer
    ReadonlyMetadata
    ScheduleEvent
    ScheduleFilterResolvable
    ScheduleInterval
    ScheduleJobParams
    ScheduleMiddlewareResolvable
    ScheduleTickArgs
    SerializableFeature
    SubCommandData
    SubCommandGroupData
    Tail
    TimerJobHandle
    TopLevelCommand
    TypedField
    BotServiceEventEnum
    BotStatusEnum
    CommandEventEnum
    EventBusEventEnum
    EventSubscriberLifetimeEnum
    PluginEventEnum
    PriorityEnum
    ScheduleEventEnum
    SerializableFeatureEnum
    TypedFields
    canBeIdentifier
    ensureKey
    getCommandNameTree