Skip to Content
nyx logonyx guide

Plugins Overview

Reading time:0 min read

Plugins are objects that can be used to pack functionality, such as commands, events and schedules.

Usage

Plugin creation

Create a class that implements NyxPlugin.

import { NyxPlugin,  } from '@nyx-discord/djs';

class  implements NyxPlugin {
  public static readonly  = ('my-plugin');

  public async (: ) {
    .().('My plugin has been registered!');
  }

  public async (: ) {
    .().('My plugin has been unregistered!');
  }

  public () {
    return {
      : 'my-plugin',
      : '1.0.0',
      : 'My plugin',
      // Optional
      : 'https://github.com/...',
    }
  }

  public () {
    return .;
  }
}

The getData() method is unused by the framework, but it provides information to the plugin's consumer.

Registration

Register it to a bot's PluginManager:

await .().(new ());

On this page