docsGuidesCLI Getting Started

Getting Started

Welcome to ZBR! This guide will help you set up your development environment and create your first Discord bot.

Prerequisites

Installation

Install the ZBR CLI globally using npm:

npm i @zbrlang/zbr

Creating a Project

  1. Initialize a new ZBR project:
    zbr init my-awesome-bot
  2. Navigate to your project directory:
    cd my-awesome-bot
  3. Open .env and paste your configuration:
    DISCORD_TOKEN=your_token_here
    DATABASE_URL=sqlite://data.db

Running the Bot

Start the bot with the unified runner:

zbr run

You can also use zbr help to see all available commands.

ZBR CLI commands

Use zbr help to list the available CLI commands. Common commands include:

zbr init <folder>     Initialize a new ZBR project in the specified folder (defaults to current directory)
zbr run               Start the ZBR runtime engine and bring your bot online
zbr update            Download and install the latest ZBR runtime engine
zbr version           Show the current ZBR version
zbr list              List all commands in your commands/ folder
zbr new <type>        Scaffold a new command file (prefix, slash, sub-slash, interaction, event)
zbr help              Show this help message

The zbr new <type> command creates a starter command file using the selected type. For example:

zbr new prefix
zbr new slash
zbr new sub-slash
zbr new interaction
zbr new event

This is a quick way to get a basic .zbr command file scaffolded so you can start building faster.

Command Headers

Every .zbr file must start with a header section that defines how the command is triggered and configured. Header lines always start with #.

Valid Keywords

  • trigger: The activation keyword or event name.
  • name: Internal identifier for the command.
  • description: A short description (used in slash commands).
  • type: Command mode: prefix, slash, sub-slash, interaction, or event.
  • scope: Where to register: guild, global, or both.
  • option: Defines slash command options.

Example Command

#trigger !hello
#name Hello Command
#type prefix
#description A simple greeting command

// This is a comment
Hello, Zusername{}!

Your bot is now online! Try typing !hello in your Discord server.