Kojima Bot is a Bun-native application and ships with two supported ways to keep it running: launching it directly withDocumentation 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.
bun start, or using PM2 with the included ecosystem.config.cjs for process supervision, automatic restarts, and log management. Choose whichever fits your infrastructure — both approaches are covered below.
Development mode
During active development, usebun run dev. This invokes bun run --watch src/index.ts, which monitors source files for changes and restarts the process automatically whenever you save.
--watch flag is convenient for iterating on commands or logic, but it should not be used in production — an accidental file write or an in-progress edit could cause unexpected restarts while users are interacting with the bot.
Production: direct Bun
The simplest production deployment is to run the bot entry point directly with Bun:bun run src/index.ts with no process manager involved. It is straightforward and works well if you manage the process lifecycle yourself (e.g. via a systemd unit, a container restart policy, or a shell nohup).
Production: PM2
PM2 is a process manager that keeps the bot alive across crashes, restarts it on reboot, and provides a built-in logging subsystem. The repository includes a ready-to-useecosystem.config.cjs.
Review the ecosystem config
The included
ecosystem.config.cjs configures PM2 to run the bot using Bun as the interpreter and ensures Bun’s binary directory is on the PATH:Registering slash commands
Before users can interact with the bot’s slash commands, you must register them with Discord. Run the deploy script once after installation, and again whenever you add, rename, or remove commands:src/deploy-commands.ts, which registers all commands as guild-scoped commands against the server identified by GUILD_ID in your .env. Guild-scoped commands appear instantly (unlike global commands, which can take up to an hour to propagate).
Environment file
The bot reads configuration at startup from a.env file in the working directory. Make sure .env is present and populated before starting the process:
DISCORD_TOKEN, CLIENT_ID, and GUILD_ID. All other variables are optional. See the Configuration page for the full reference.
PM2 uses Bun as the interpreter (
interpreter: 'bun') — make sure Bun is on the system PATH or specify the full path in ecosystem.config.cjs. The ecosystem config already appends $HOME/.bun/bin to PATH for convenience, but if Bun is installed elsewhere you may need to adjust that value.