Advanced Features & Plugins

Context System (ctx)

`ctx` normalizes both message and interaction data into one consistent interface:

  • ctx.user: current user
  • ctx.guild: current guild
  • ctx.channel: current channel
  • ctx.reply(content | options): smart response helper
  • ctx.deferReply(ephemeral?): defer interaction replies
  • ctx.editReply(content | options): edit deferred replies
  • ctx.followUp(content | options): send follow-up messages
  • ctx.showModal(modal): open a modal
  • ctx.values: modal/select values
  • ctx.args: prefix args or slash option values
  • ctx.isInteraction: interaction check
  • ctx.createdAt: creation timestamp

Dynamic & Recursive Loading

discordjs-nextgen lets you organize your file structure freely. Subfolders are scanned automatically.

1src/
2 commands/
3 general/
4 ping.ts
5 help.ts
6 admin/
7 ban.ts
8 kick.ts
9 events/
10 guild/
11 ready.ts
12 message/
13 messageCreate.ts

When you call app.prefix({ folder: 'commands' }) or app.events('events'), the framework walks every nested folder and loads files automatically.

Middleware System

Write your own middleware. Middleware runs before commands execute:

1app.use(async (ctx, next) => {
2 Logger.info(`${ctx.user.tag} triggered an action.`);
3 await next();
4 Logger.success('Action completed.');
5});

Plugin System

Extend your bot with modular plugins. This is especially useful for larger projects.

1app.use({
2 name: 'my-plugin',
3 setup: (bot) => {
4 bot.on('ready', (client) => {
5 Logger.info(`${client.user.tag} plugin is ready!`);
6 });
7 }
8});