Kojima Bot’s command system is designed to be extended without modifying core files. Any TypeScript or JavaScript file you place directly inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/noskap/kojima-bot/llms.txt
Use this file to discover all available pages before exploring further.
src/commands/ is picked up automatically when the bot starts — no registration in a manifest file, no changes to src/index.ts required. A ready-to-copy template lives at src/commands/custom/example.ts.
How command loading works
At startup, theloadCommands() function in src/index.ts reads every .ts and .js file from the top-level src/commands/ directory (non-recursive), excluding index.ts. Subdirectories such as src/commands/custom/ are not scanned — only files placed directly in src/commands/ are loaded.
Each file must export a Command object as its default export. The loader checks that the export has both a data property (a SlashCommandBuilder or equivalent) and an execute property (an async handler function). Files missing either property are skipped with a warning in the console.
After loadCommands() finishes, meme-image commands are registered via registerMemeSlashHandlers(). All commands are then stored in a Collection<string, Command> keyed by command name and dispatched from the InteractionCreate event handler.
Creating a custom command
Create a new file in src/commands/
Name the file after your command, for example
src/commands/hello.ts. You can use src/commands/custom/example.ts as a template — copy it up one level to src/commands/.Export a default Command object
Here is the full example from Replace
src/commands/custom/example.ts — copy it as a starting point:src/commands/hello.ts
"mycommand" with the name of your slash command (lowercase, no spaces) and update the description and handler logic as needed.Register the command with Discord
Run the deploy script to push the new slash command to your guild:Commands are registered guild-scoped (using
GUILD_ID from .env) and appear in Discord immediately.The Command interface
TheCommand interface is exported from src/index.ts and is the only contract your custom command file needs to satisfy:
data is typically a SlashCommandBuilder instance — it provides both the name string and the toJSON() method used when registering with Discord’s API. execute receives a fully typed ChatInputCommandInteraction and must return a Promise<void>.
Accessing config
ImportCONFIG from ../config to read runtime configuration values in your command handler. The most commonly useful property for custom commands is CONFIG.ENTITY_NAME, which reflects whatever name the server operator has set in .env:
CONFIG.GUILD_ID, CONFIG.CATCH_TRIGGER, and the link-fixup flags. See src/config.ts for the full list.
Accessing the database
Import thedb instance and schema tables to read or write bot data from a custom command:
users, channels, profiles, achievementUnlocks) are available as named exports from ../db/schema.
The
src/commands/custom/ directory exists as a template folder and is not gitignored. Place your actual command files directly in src/commands/ so they are picked up by loadCommands().