Native Commands & [Menu] Button

Raw MD
Configure slash command autocompletes, admin-only command scopes, and the persistent blue [Menu] button.

Registering Commands with setMyCommands

Telegram allows bots to register slash commands that appear in a popup menu when the user types /. In Botlify, we configure them automatically or on demand using setMyCommands:

setMyCommands Implementation
function setup_bot_commands(): void {
    // 1. General User Commands (All Private Chats)
    bot('setMyCommands', [
        'commands' => [
            ['command' => 'start',    'description' => '🚀 Launch main dashboard'],
            ['command' => 'menu',     'description' => '📋 Open interactive menu'],
            ['command' => 'balance',  'description' => '💰 View account balance'],
            ['command' => 'support',  'description' => '💬 Contact live support']
        ],
        'scope' => ['type' => 'all_private_chats']
    ]);

    // 2. Admin Only Commands
    bot('setMyCommands', [
        'commands' => [
            ['command' => 'admin',     'description' => '👑 Open Admin Control Center'],
            ['command' => 'broadcast', 'description' => '📢 Send mass broadcast to users'],
            ['command' => 'stats',     'description' => '📊 View platform telemetrics']
        ],
        'scope' => ['type' => 'chat', 'chat_id' => ADMIN_CHAT_ID]
    ]);

    // 3. Set the Persistent Blue [Menu] Button
    bot('setChatMenuButton', [
        'menu_button' => ['type' => 'commands']
    ]);
}