copy Copy chevron-down
book-open-cover Pre Built Libraries pen-to-square Bot:: Library FunctionsThe Bot:: class provides built-in helper functions to simplify working with your Telegram bots in PHP. Here's a list of available methods you can use inside your command code editor:
📨 Bot::sendMessage()
Copy Bot :: sendMessage ($ chatId , $ message , $ parse_type = ' HTML ' ); Description:
Sends a text message to a user or group.
Parameters:
chatId (int|string) – The Telegram chat ID to send the message to
message (string) – The message text
parse_type (string) – Message format ("HTML", "Markdown")
Example:
Copy Bot :: sendMessage ($ chatId , " Hello <b>World</b>! " , " HTML " ); 💾 Bot::setProperty()
Copy Bot :: setProperty ( ' key ' , ' value ' ); Description:
Stores a value using a key. This is useful for saving data like user states, progress, or preferences.
Parameters:
key (string) – The identifier for the data
value (mixed) – The value to store
Example:
🔍 Bot::getProperty()
Description:
Retrieves a previously stored value using setProperty().
Parameters:
key (string) – The key used when saving the value
Returns:
Stored value (or null if not found)
Example:
❌ Bot::deleteProperty()
Description:
Deletes a previously stored property.
Parameters:
key (string) – The key to delete
Example:
👤 Bot::getUser()
Description:
Gets the stored data of another user by their Telegram chat ID.
Parameters:
chat_id (int|string) – The Telegram chat ID of the user
Returns:
User data array or null if user not found.
Example:
📋 Bot::getAllUser()
Description:
Retrieves a list of all users that have interacted with the bot.
Returns:
Array of user data.
Example:
📢 Bot::runAll()
Description:
Schedules or runs a command for all users, optionally filtering by chat type.
Parameters:
command (string) – The command to execute
chat_type (string|null) – Optional: Filter by private, group, chanel, etc.
time (int|null) – Optional: Unix timestamp of when to run the command
options (array) – Optional: Extra data to pass to the command
Example:
🧩 Bot::runCommand()
Description:
Runs a command as a specific user, optionally scheduled for later.
Parameters:
command (string) – The command name
userId (int|string) – The user to run the command as
time (int|null) – Optional: Unix timestamp to delay execution
options (array) – Optional: Extra data to include
Example:
🌐 Bot::getPublicCommandUrl()
Description:
Generates a public webhook URL to execute a specific command with POST data.
Parameters:
command_id (string) – The command ID to expose via public URL
Returns:
A public URL string
Example:
🔗 Bot::getBotLink()
Description:
Gets the current bot's public Telegram link (e.g., https://t.me/MyBotName).
Returns:
A string URL of the bot.
Example:
Last updated 9 months ago