Skip to content

TBL Libraries (Libs)

The Libs instance provides direct access to TBL's built-in helper libraries.

These libraries handle common bot tasks: randomization, date and time operations, resource tracking, referrals, and Telegram-specific utilities.

Usage

Libs.random.int(1, 100)
Libs.dateTimeFormat.now()
Libs.tgutil.getFullName(user)

Most methods return Promises. Using await is optional unless you need the returned value.

What Libs Is Used For

Libs helps you avoid repetitive logic by offering ready-to-use helpers for:

  • Tracking counters, balances, and shared values
  • Formatting and calculating dates and times
  • Checking user membership in channels or groups
  • Generating random values
  • Building referral systems
  • Working with Telegram names, mentions, and formatting

Available Libraries

Library Description
ResourcesLib User-level or global counters, balances, and persistent values
dateTimeFormat Format dates, add or subtract time, calculate differences
MCL Check channel or group membership
random Generate random numbers, strings, colors, and dates
refLib Create referral links and track invited users
tgutil Telegram names, mentions, links, and text escaping

Notes

  • Libs is available globally in TBL
  • No setup or imports are required
  • Designed for simplicity and performance
  • Works seamlessly with commands and callbacks

For general-purpose npm-style utilities, see Modules.