NeriTest

Examples

Each bot in bots/ is written the way you'd write it for production: an attach(client) factory that wires handlers to a real nerimity.js Client. The same code runs in the sandbox (attach(await sandbox.createClient())) and against a live server (attach(new Client())).

File Pattern
bots/ping-pong.ts reply + edit, latency
bots/welcome.ts serverMemberJoined, HTML greeting
bots/moderation.ts permission checks, ban/kick, error handling
bots/automod.ts delete + warn on banned words
bots/reaction-roles.ts messageReactionAdded → assign role
bots/economy.ts cooldowns via an injected clock (virtual time)
bots/reminder.ts scheduled jobs via an injected scheduler
bots/slash-commands.ts message.command, command registration
bots/logging.ts messageUpdate / messageDelete mirroring

standalone/vanilla-bot.cjs is a completely unmodified bot with no NeriTest imports, run via sandbox.loadBot(...).

bots.test.ts exercises all of the above in the sandbox - read it as a worked cookbook. Run everything with:

Shell
npm test