Advanced Features & Plugins
Context System (ctx)
`ctx` normalizes both message and interaction data into one consistent interface:
ctx.user: current userctx.guild: current guildctx.channel: current channelctx.reply(content | options): smart response helperctx.deferReply(ephemeral?): defer interaction repliesctx.editReply(content | options): edit deferred repliesctx.followUp(content | options): send follow-up messagesctx.showModal(modal): open a modalctx.values: modal/select valuesctx.args: prefix args or slash option valuesctx.isInteraction: interaction checkctx.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.ts5 help.ts6 admin/7 ban.ts8 kick.ts9 events/10 guild/11 ready.ts12 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});