> For the complete documentation index, see [llms.txt](https://bots-mother.gitbook.io/bots-mother-help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bots-mother.gitbook.io/bots-mother-help/pre-built-libraries/bot-library-functions.md).

# Bot:: Library Functions

#### 📨 `Bot::sendMessage()`

```php
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:**

```php
Bot::sendMessage($chatId, "Hello <b>World</b>!", "HTML");
```

***

#### 💾 `Bot::setProperty()`

```php
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:**

```php
Bot::setProperty("status", "Under Development");
```

***

#### 🔍 `Bot::getProperty()`

```php
$value = Bot::getProperty('status');
```

**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:**

```php
$step = Bot::getProperty("status");
```

***

#### ❌ `Bot::deleteProperty()`

```php
Bot::deleteProperty('status');
```

**Description:**\
Deletes a previously stored property.

**Parameters:**

* `key` *(string)* – The key to delete

**Example:**

```php
Bot::deleteProperty("status");
```

***

#### 👤 `Bot::getUser()`

```php
$user = Bot::getUser($chat_id);
```

**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:**

```php
$user = Bot::getUser(123456789);
```

***

#### 📋 `Bot::getAllUser()`

```php
$users = Bot::getAllUser();
```

**Description:**\
Retrieves a list of all users that have interacted with the bot.

**Returns:**\
Array of user data.

**Example:**

```php
$allUsers = Bot::getAllUser();
```

***

#### 📢 `Bot::runAll()`

```php
Bot::runAll($command, $chat_type = null, $time = null, $options = []);
```

**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:**

```php
Bot::runAll("start", "private", time() + 3600, ["promo" => "yes"]);
```

***

#### 🧩 `Bot::runCommand()`

```php
Bot::runCommand($command, $userId, $time = null, $options = []);
```

**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:**

```php
Bot::runCommand("checkStatus", 123456789, null, ["key" => "value"]);
```

***

#### 🌐 `Bot::getPublicCommandUrl()`

```php
$url = Bot::getPublicCommandUrl($command_id);
```

**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:**

```php
$link = Bot::getPublicCommandUrl("externalWebhook");
```

***

#### 🔗 `Bot::getBotLink()`

```php
$link = 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:**

```php
$botUrl = Bot::getBotLink();
```

***
