Skip to main content

File Structure

A .botgami file has a predictable shape. This page is the full anatomy, top to bottom.

Order of declarations

package (optional)
imports (optional, before the bot block)
bot Name {
meta { … } (optional)
variables (user / shared / global declarations)
subflows (reusable blocks)
flows (one per trigger)
}

A complete labelled skeleton

// 1. Package — optional namespace marker.
package main

// 2. Imports — bring in standard libraries. Must come BEFORE the bot block.
import format from "format"
import nowpayments from "nowpayments"

// 3. The bot block — everything lives here.
bot ExampleBot {

// 4. Store metadata — how your bot appears in the Store.
meta {
name: "Example Bot"
slug: "example-bot"
description: "Shows the full file layout."
author: "You"
version: "1.0.0"
category: "utility"
tags: ["demo", "reference"]
icon: "✨"
}

// 5. Variable declarations.
global api_key: String = "" // secret — set in Variables panel
global admin_id: Number = 0
user balance: Number = 0 // persistent per user
user history: Array<String> = []
shared total_sales: Number = 0 // bot-wide

// 6. Subflows — reusable, parameterized blocks.
subflow notify(text: String) {
send.text(text, chat_id: global.admin_id)
return {}
}

// 7. Flows — one per trigger, run top to bottom.
flow start on command "/start" {
set { user.balance += 1 }
await notify(text: `${user.first_name} opened the bot`)
send.text(`Welcome! Balance: ${user.balance}`)
}

flow help on command "/help" {
send.text("/start — begin\n/help — this message")
}
}

Comments

// Single-line comment

/*
Multi-line
block comment
*/

Identifiers and keywords

Bot, flow, subflow, and variable names are identifiers (letters, digits, underscores; not starting with a digit).

warning

when is a reserved control-flow keyword. Don't use it as a variable name — pick something like flow.condition instead.

Next