Running the bot

Requirements, configuration, scripts and troubleshooting for whoever hosts Kijiio Bot.

This page is for whoever runs the bot's process. Server admins only need the earlier pages.

Requirements

  • Node.js 22.15 or newer, and PM2 installed globally.
  • A MariaDB database. The ticket system creates and updates its own tables when it starts.

Configuration

Settings live in config.json (production) and config.dev.json (development) as PM2 env blocks, or in the hep.gg secrets vault. The ones the ticket system depends on:

VariableWhat it is
TOKENThe bot token.
TICKET_GUILDID of the server the ticket system belongs to. Ticket commands only work there, and in production they are only registered there. Blank turns the ticket system off.
CONTROL_GUILDServer where commands are registered in development. In development, TICKET_GUILD must be the same server.
DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAMEThe MariaDB connection. Without it, ticket commands reply that the system is unavailable.
INTENTSGateway intents. The bot needs only Guilds.

If you use the vault, its values override the config files for any key it holds. Keep TICKET_GUILD out of the vault and set it in each config file, so development can point at a test server.

Scripts

CommandWhat it does
npm install --allow-remote=allInstalls dependencies. The flag is needed because packages come from npm.hep.gg.
npm startBuilds and starts the production bot under PM2.
npm run devBuilds, then recompiles and restarts on every change. Stop it with Ctrl+C.
npm run rebuildClears dist/ and builds from scratch.
npm testBuilds and runs the test suite.

npm run dev runs PM2 with its own home directory (.pm2/ in the project), so pressing Ctrl+C only stops the development bot, never other PM2 apps on the machine.

Troubleshooting

What you seeCause and fix
"Tickets are not available in this server."The command was used outside TICKET_GUILD, or TICKET_GUILD is blank. Check the value, then run npm run rebuild in case an old build is loaded.
"The ticket system is unavailable..."The database is not configured or could not be reached at startup. The log shows Ticket system failed to start with the reason.
"Tickets are not set up yet."No Discord category is set. Run /ticket-admin setup.
"Ticket channels are full right now."The ticket category, and the overflow category if set, each hold 50 channels. Set or empty an overflow category.
"I could not create your ticket channel because I am missing permissions."The bot needs Manage Channels and Manage Roles, and must be able to see the ticket category.
"The transcript could not be saved, so nothing was deleted."Usually the bot cannot post in the archive channel. Give it View Channel, Send Messages, Embed Links and Attach Files there, then press Close again.
Error: Missing object id in the logsINTENTS includes GuildPresences. Set it to Guilds and restart.
Commands do not appearIn development, check CONTROL_GUILD and look for Deployed N commands in the log.

When the bot starts, it closes tickets whose channels were deleted while it was offline, and logs any ticket stuck partway through closing. Press Close in that ticket's channel to finish it.