# Generated by scripts/generate-llms-txt.ts - do not edit by hand # Generated at: 2026-07-02T17:28:43.780Z # Sources: src/constants/defaultBotVariableDefinitions.ts # MasterBot - Variable syntax and BOT variable catalog Reference for AI assistants building flows. Index: https://masterbot.gg/llms.txt Total built-in BOT variables: 32 ## Two variable families | Family | Syntax | Storage | |--------|--------|---------| | **BOT** | `{user_id}`, `{channel_name}` - no prefix | Built-in, filled from flow context | | **Custom** | `{MB_coins}`, `{MB_prefix}` - always `MB_` prefix | Database at /dashboard/database | ## Syntax patterns | Pattern | Example | Meaning | |---------|---------|---------| | BOT variable | `{user_id}` | Built-in from context | | Custom variable | `{MB_coins}` | Your database variable | | Target override | `{user_name[{option_user}]}` | BOT var for another user | | Custom + target | `{MB_points[{user_id}]}` | Map entry for a user | | Server scope | `{MB_prefix}` | Resolves per guild when scope is server | | Math | `{math[2+2]}` | Inline calculation | | Math + var | `{math[{MB_points}/2+30]}` | Formula with variables | | Format number | `{formatNumber({MB_score}),[compact]}` | Display formatting | | Format time | `{time_now,[DD/MM/YY]}` | Date/time with format | | Random text | `{random[COM_***]}` | Mask-based random string | ## Custom variable scopes | Scope | Meaning | |-------|---------| | `global` | One value for the entire bot | | `server` | Value per Discord guild | | `server-user` | Per user within a server | | `server-channel` | Per channel within a server | Targetable custom variables use bracket syntax: `{MB_points[{user_id}]}` ## Math expressions Syntax: `{math[expression]}` or `{math[expression],[format]}` Operators: `+`, `-`, `*`, `/`, `^`, `(`, `)`, `%` (percent style), `%%` (modulo) Functions: floor, ceil, round, abs, min, max, clamp, pow, sqrt, sin, cos, random(), randomInt(a,b), pi, e, and more. Use the **Calculate** node to store results into a variable. ## Ranking helpers (leaderboards) For targetable number maps (e.g. `{MB_points}`): - `{rankAtValue({MB_points}), [1]}` - value at rank 1 (highest) - `{rankAtTarget({MB_points}), [2]}` - entity ID at rank 2 - `{rankOf({MB_points[userId]})}` - forward rank of entity - `{rankPrint({MB_points}), [format], 1, 10}` - formatted leaderboard rows - Reverse variants: `rankAtValue_rev`, `rankOf_rev`, `rankPrint_rev` (rank from lowest value) Server scope: `{rankAtValue({MB_points[s:guildId]}), [1]}` ## Flow nodes for variables - **Set Variable** - write values - **Reset Variable** - clear values - **Calculate** - math and store result ## BOT variables by category ### Bot (application user) - `{bot_avatar}` (scalar) - Avatar image URL of this bot (PNG, 256px) - `{bot_displayName}` (scalar) - Display name of this bot: server nickname in guild context, otherwise global name or username - `{bot_global_name}` (scalar) - Discord global display name of this bot, if set - `{bot_id}` (scalar) - Discord snowflake ID of this bot (the logged-in application user) - `{bot_mention}` (scalar) - Mention of this bot (<@bot_id>) - `{bot_name}` (scalar) - Username of this bot (login name, not display name) - `{bot_ping}` (scalar) - Discord Gateway WebSocket heartbeat round-trip time in milliseconds (live when the flow runs) - `{bot_role}` (targetable) - Discord snowflake ID of this bot's managed (integration) role on the server. Default: current guild. Target with [guildId] or [server:guildId] for another server. - `{bot_server_count}` (scalar) - Number of servers (guilds) this bot is currently in - `{bot_uptime}` (scalar) - Uptime in whole seconds when the flow runs. Optional {bot_uptime,[...]} like time_now: default = seconds; [Unix]/[ISO] = when the session became ready (not uptime length); [ms], [human], patterns TH/DD/HH/mm/ss, etc. ### Channel - `{channel}` (targetable) - Mention of the current channel (<#id>). Default: channel where the command or event runs. Target: channel ID or variable returning channel ID. - `{channel_category}` (targetable) - Name of the current channel category, if the channel has a parent category. Target: channel ID or variable returning channel ID. - `{channel_id}` (targetable) - Discord ID of the current channel. Target: channel ID or variable returning channel ID. - `{channel_name}` (targetable) - Name of the current channel. Target: channel ID or variable returning channel ID. - `{channel_nsfw}` (targetable) - Whether the current channel is marked as NSFW. Target: channel ID or variable returning channel ID. - `{channel_position}` (targetable) - Position of the current channel in the server channel list. Target: channel ID or variable returning channel ID. - `{channel_topic}` (targetable) - Topic of the current text channel, if set. Empty for DMs or channels without topic. Target: channel ID or variable returning channel ID. ### Date and time - `{time_now}` (scalar) - Current date/time as Unix timestamp (seconds). Use with format, e.g. {time_now,[DD/MM/YY]} or {time_now,[YYYY-MM-DD HH:mm | tz=Europe/Warsaw]}. Without tz= in the format, uses the bot default timezone from Bot Settings (timed events). ### User - `{user}` (targetable) - Mention of the user (<@id>). Default subject: interaction user, message author on message events, or the guild member on member join/leave and member-role events (no message there). Target another user: {user[id]} or {user[variable]}. Target: user ID or variable returning user ID. - `{user_avatar}` (targetable) - Avatar image URL (PNG, 256px). Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_created_at}` (targetable) - Unix timestamp when the Discord account was created. Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_displayName}` (targetable) - Display name: server nickname or global name. Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_globalName}` (targetable) - Discord global display name. Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_id}` (targetable) - Discord user ID. Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_joined_at}` (targetable) - Unix timestamp when the user joined the server. Empty in DMs. Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_name}` (targetable) - Discord username. Default subject same as {user}. Target: user ID or variable returning user ID. - `{user_status}` (targetable) - Discord presence status: online, idle, dnd, offline, or invisible. Default subject same as {user}. Requires guild context. Target: user ID or variable returning user ID. ### Server (guild) - `{server_icon}` (targetable) - Icon image URL of the current server. Target: server ID or variable returning server ID. - `{server_id}` (targetable) - Discord ID of the current server. Target: server ID or variable returning server ID. - `{server_member_count}` (targetable) - Approximate number of members in the current server. Target: server ID or variable returning server ID. - `{server_name}` (targetable) - Name of the current server. Target: server ID or variable returning server ID. - `{server_owner}` (targetable) - Mention of the current server owner (<@id>). Target: server ID or variable returning server ID. ## Related - Capabilities overview: https://masterbot.gg/llms-capabilities.txt - Tutorial: https://masterbot.gg/tutorials/variables - Static HTML guide (MB_ custom vars): https://masterbot.gg/variable-system-guide.html - Database UI: https://masterbot.gg/dashboard/database