Skip to content

Installation

Sayrix edited this page Apr 29, 2026 · 3 revisions

This page explains the non-Docker installation path. For containers, see Docker Setup.

Requirements

Ticket-Bot v4 expects:

  • Bun 1.0 or newer for the documented setup commands
  • Node.js 20 or newer if you build first and run the compiled output
  • Git
  • A Discord bot token
  • A Discord server where you can invite the bot

The project uses TypeScript, @discordjs/core, Drizzle, and a SQLite/libSQL database URL.

Install Dependencies

git clone https://github.com/Sayrix/Ticket-Bot.git
cd Ticket-Bot
bun install

Environment Variables

Ticket-Bot reads environment variables from config/.env.

Create config/.env:

DISCORD_TOKEN=your_bot_token_here
DB_FILE_NAME=file:.data/ticket-bot.db
TICKETPM_PASSKEY=
Variable Required Purpose
DISCORD_TOKEN Yes Bot token from the Discord Developer Portal.
DB_FILE_NAME Yes SQLite/libSQL database URL used by Drizzle.
TICKETPM_PASSKEY No Passkey used for ticket.pm transcript uploads.

For local SQLite, use a file URL such as:

DB_FILE_NAME=file:.data/ticket-bot.db

Keep .data/ backed up because it stores ticket records and tracked panel messages.

Configuration File

Copy the example:

cp config/config.example.ts config/config.ts

PowerShell:

Copy-Item config/config.example.ts config/config.ts

Then edit config/config.ts. At minimum, replace:

  • clientId
  • guildId
  • logs.channelId
  • tickets.staffRoleIds
  • each ticketTypes.*.categoryId
  • each panels.*.channelId

See Configuration for every option.

Database Setup

Run:

bun run drizzle:push

This applies the schema from src/db/schema.ts. The schema stores:

  • Tracked panel messages.
  • Application metadata.
  • Ticket records, including creator, channel, status, claim, close reason, invited users, and transcript URL.

Slash Commands

The bot deploys slash commands automatically on startup. Commands are deployed to the configured guildId, so they should appear quickly in that server.

Start the Bot

bun run start

Run with Node.js and npm

If you prefer Node.js, install dependencies with npm, build the TypeScript output, then run the compiled bot:

npm install
npm run drizzle:push
npm run build
npm run node:start

Use Node.js 20 or newer. The node:start script runs dist/src/index.js, so run npm run build again after changing files under src/, config/, messages/, or i18n/.

Useful package scripts:

Command Purpose
bun run start Start the bot.
bun run node:start Start the compiled output after bun run build.
npm run node:start Start the compiled output with Node.js after npm run build.
bun run drizzle:push Apply database schema changes.
bun run typecheck Run TypeScript checks.
bun run lint Run Biome linting.
bun run format Check formatting.
bun run format:fix Rewrite formatting.
bun run build Build the project.

Startup Behavior

When the bot starts, it:

  1. Loads config/.env.
  2. Imports config/config.ts.
  3. Connects to Discord.
  4. Validates that the configured guild is accessible.
  5. Warns if the bot does not have Administrator.
  6. Validates configured panel channels.
  7. Deploys slash commands.
  8. Syncs panel messages.
  9. Applies configured presence.
  10. Starts telemetry according to the config.

Clone this wiki locally