{"id":13405279,"url":"https://github.com/php-telegram-bot/core","last_synced_at":"2025-05-13T15:09:36.117Z","repository":{"id":34243369,"uuid":"38116958","full_name":"php-telegram-bot/core","owner":"php-telegram-bot","description":"PHP Telegram Bot based on the official Telegram Bot API","archived":false,"fork":false,"pushed_at":"2025-03-20T16:07:18.000Z","size":3948,"stargazers_count":3962,"open_issues_count":72,"forks_count":963,"subscribers_count":200,"default_branch":"develop","last_synced_at":"2025-04-23T18:54:02.807Z","etag":null,"topics":["bot-api","hacktoberfest","php","php-telegram-bot","sdk","sdk-php","telegram","telegram-api","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-telegram-bot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-26T14:55:57.000Z","updated_at":"2025-04-22T16:28:10.000Z","dependencies_parsed_at":"2024-02-22T02:25:21.677Z","dependency_job_id":"ebb69748-0359-4582-a3ed-001f330bef4d","html_url":"https://github.com/php-telegram-bot/core","commit_stats":{"total_commits":1284,"total_committers":82,"mean_commits":"15.658536585365853","dds":0.5412772585669782,"last_synced_commit":"ca9eeb1c9e51c39a33070efeba01aac105ed9aa7"},"previous_names":["akalongman/php-telegram-bot"],"tags_count":80,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-telegram-bot%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-telegram-bot%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-telegram-bot%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-telegram-bot%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-telegram-bot","download_url":"https://codeload.github.com/php-telegram-bot/core/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969240,"owners_count":21992262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot-api","hacktoberfest","php","php-telegram-bot","sdk","sdk-php","telegram","telegram-api","telegram-bot"],"created_at":"2024-07-30T19:01:58.340Z","updated_at":"2025-05-13T15:09:31.103Z","avatar_url":"https://github.com/php-telegram-bot.png","language":"PHP","readme":"\n\u003ch1 align=\"center\"\u003eThe development of the project is currently on hold until further notice. We will provide updates as soon as they become available.\u003c/h1\u003e\n\u003ch1 align=\"center\"\u003e\n    PHP Telegram Bot\u003cbr\u003e\n\t\u003cbr\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/php-telegram-bot/assets/master/logo/512px/logo_plain.png\" title=\"PHP Telegram Bot\" alt=\"PHP Telegram Bot logo\"\u003e\n\t\u003cbr\u003e\n\u003c/h1\u003e\n\nA Telegram Bot based on the official [Telegram Bot API]\n\n[![API Version](https://img.shields.io/badge/Bot%20API-7.1%20%28February%202024%29-32a2da.svg)](https://core.telegram.org/bots/api-changelog#february-16-2024)\n[![Join the bot support group on Telegram](https://img.shields.io/badge/telegram-@PHP__Telegram__Bot__Support-64659d.svg)](https://telegram.me/PHP_Telegram_Bot_Support)\n[![Donate](https://img.shields.io/badge/%F0%9F%92%99-Donate%20%2F%20Support%20Us-blue.svg)](#donate)\n\n[![Tests](https://github.com/php-telegram-bot/core/actions/workflows/tests.yaml/badge.svg)](https://github.com/php-telegram-bot/core/actions/workflows/tests.yaml)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-telegram-bot/core/master.svg?style=flat)](https://scrutinizer-ci.com/g/php-telegram-bot/core/?b=master)\n[![Code Quality](https://img.shields.io/scrutinizer/g/php-telegram-bot/core/master.svg?style=flat)](https://scrutinizer-ci.com/g/php-telegram-bot/core/?b=master)\n[![Latest Stable Version](https://img.shields.io/packagist/v/longman/telegram-bot.svg)](https://packagist.org/packages/longman/telegram-bot)\n[![Dependencies](https://tidelift.com/badges/github/php-telegram-bot/core?style=flat)][Tidelift]\n[![Total Downloads](https://img.shields.io/packagist/dt/longman/telegram-bot.svg)](https://packagist.org/packages/longman/telegram-bot)\n[![Downloads Month](https://img.shields.io/packagist/dm/longman/telegram-bot.svg)](https://packagist.org/packages/longman/telegram-bot)\n[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D8.1-8892BF.svg)](https://php.net/)\n[![License](https://img.shields.io/packagist/l/longman/telegram-bot.svg)](https://github.com/php-telegram-bot/core/LICENSE)\n\n## Table of Contents\n- [Introduction](#introduction)\n- [Instructions](#instructions)\n    - [Create your first bot](#create-your-first-bot)\n    - [Require this package with Composer](#require-this-package-with-composer)\n    - [Choose how to retrieve Telegram updates](#choose-how-to-retrieve-telegram-updates)\n- [Using a custom Bot API server](#using-a-custom-bot-api-server)\n- [Webhook installation](#webhook-installation)\n    - [Self Signed Certificate](#self-signed-certificate)\n    - [Unset Webhook](#unset-webhook)\n- [getUpdates installation](#getupdates-installation)\n    - [getUpdates without database](#getupdates-without-database)\n- [Filter Update](#filter-update)\n- [Support](#support)\n    - [Types](#types)\n    - [Inline Query](#inline-query)\n    - [Methods](#methods)\n    - [Send Message](#send-message)\n    - [Send Photo](#send-photo)\n    - [Send Chat Action](#send-chat-action)\n    - [getUserProfilePhoto](#getuserprofilephoto)\n    - [getFile and downloadFile](#getfile-and-downloadfile)\n    - [Send message to all active chats](#send-message-to-all-active-chats)\n- [Utils](#utils)\n    - [MySQL storage (Recommended)](#mysql-storage-recommended)\n        - [External Database connection](#external-database-connection)\n    - [Channels Support](#channels-support)\n- [Commands](#commands)\n    - [Predefined Commands](#predefined-commands)\n    - [Custom Commands](#custom-commands)\n    - [Commands Configuration](#commands-configuration)\n    - [Admin Commands](#admin-commands)\n        - [Set Admins](#set-admins)\n        - [Channel Administration](#channel-administration)\n- [Upload and Download directory path](#upload-and-download-directory-path)\n- [Logging](doc/01-utils.md)\n- [Documentation](#documentation)\n- [Assets](#assets)\n- [Example bot](#example-bot)\n- [Projects with this library](#projects-with-this-library)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [Security](#security)\n- [Donate](#donate)\n- [For enterprise](#for-enterprise)\n- [License](#license)\n- [Credits](#credits)\n\n## Introduction\n\nThis is a pure PHP Telegram Bot, fully extensible via plugins.\n\nTelegram announced official support for a [Bot API](https://telegram.org/blog/bot-revolution), allowing integrators of all sorts to bring automated interactions to the mobile platform.\nThis Bot aims to provide a platform where one can simply write a bot and have interactions in a matter of minutes.\n\nThe Bot can:\n- Retrieve updates with [webhook](#webhook-installation) and [getUpdates](#getupdates-installation) methods.\n- Supports all types and methods according to Telegram Bot API 7.1 (February 2024).\n- Supports supergroups.\n- Handle commands in chat with other bots.\n- Manage Channel from the bot admin interface.\n- Full support for **inline bots**.\n- Inline keyboard.\n- Messages, InlineQuery and ChosenInlineQuery are stored in the Database.\n- Conversation feature.\n\n---\n\nThis code is available on [GitHub](https://github.com/php-telegram-bot/core). Pull requests are welcome.\n\n## Instructions\n\n### Create your first bot\n\n1. Message [`@BotFather`](https://telegram.me/BotFather) with the following text: `/newbot`\n\n   If you don't know how to message by username, click the search field on your Telegram app and type `@BotFather`, where you should be able to initiate a conversation. Be careful not to send it to the wrong contact, because some users have similar usernames to `BotFather`.\n\n   ![BotFather initial conversation](https://user-images.githubusercontent.com/9423417/60736229-bc2aeb80-9f45-11e9-8d35-5b53145347bc.png)\n\n2. `@BotFather` replies with:\n\n    ```\n    Alright, a new bot. How are we going to call it? Please choose a name for your bot.\n    ```\n\n3. Type whatever name you want for your bot.\n\n4. `@BotFather` replies with:\n\n    ```\n    Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.\n    ```\n\n5. Type whatever username you want for your bot, minimum 5 characters, and must end with `bot`. For example: `telesample_bot`\n\n6. `@BotFather` replies with:\n\n    ```\n    Done! Congratulations on your new bot. You will find it at\n    telegram.me/telesample_bot. You can now add a description, about\n    section and profile picture for your bot, see /help for a list of\n    commands.\n\n    Use this token to access the HTTP API:\n    123456789:AAG90e14-0f8-40183D-18491dDE\n\n    For a description of the Bot API, see this page:\n    https://core.telegram.org/bots/api\n    ```\n\n7. Note down the 'token' mentioned above.\n\n*Optionally set the bot privacy:*\n\n1. Send `/setprivacy` to `@BotFather`.\n\n   ![BotFather later conversation](https://user-images.githubusercontent.com/9423417/60736340-26439080-9f46-11e9-970f-8f33bbe39c5f.png)\n\n2. `@BotFather` replies with:\n\n    ```\n    Choose a bot to change group messages settings.\n    ```\n\n3. Type (or select) `@telesample_bot` (change to the username you set at step 5\nabove, but start it with `@`)\n\n4. `@BotFather` replies with:\n\n    ```\n    'Enable' - your bot will only receive messages that either start with the '/' symbol or mention the bot by username.\n    'Disable' - your bot will receive all messages that people send to groups.\n    Current status is: ENABLED\n    ```\n\n5. Type (or select) `Disable` to let your bot receive all messages sent to a group.\n\n6. `@BotFather` replies with:\n\n    ```\n    Success! The new status is: DISABLED. /help\n    ```\n\n### Require this package with Composer\n\nInstall this package through [Composer].\nEdit your project's `composer.json` file to require `longman/telegram-bot`.\n\nCreate *composer.json* file\n```json\n{\n    \"name\": \"yourproject/yourproject\",\n    \"type\": \"project\",\n    \"require\": {\n        \"php\": \"^8.1\",\n        \"longman/telegram-bot\": \"*\"\n    }\n}\n```\nand run `composer update`\n\n**or**\n\nrun this command in your command line:\n\n```bash\ncomposer require longman/telegram-bot\n```\n\n### Choose how to retrieve Telegram updates\n\nThe bot can handle updates with [**Webhook**](#webhook-installation) or [**getUpdates**](#getupdates-installation) method:\n\n|      | Webhook | getUpdates |\n| ---- | :----: | :----: |\n| Description | Telegram sends the updates directly to your host | You have to fetch Telegram updates manually |\n| Host with https | Required | Not required |\n| MySQL | Not required | ([Not](#getupdates-without-database)) Required  |\n\n## Using a custom Bot API server\n\n**For advanced users only!**\n\nAs from Telegram Bot API 5.0, users can [run their own Bot API server] to handle updates.\nThis means, that the PHP Telegram Bot needs to be configured to serve that custom URI.\nAdditionally, you can define the URI where uploaded files to the bot can be downloaded (note the `{API_KEY}` placeholder).\n\n```php\nLongman\\TelegramBot\\Request::setCustomBotApiUri(\n    $api_base_uri          = 'https://your-bot-api-server', // Default: https://api.telegram.org\n    $api_base_download_uri = '/path/to/files/{API_KEY}'     // Default: /file/bot{API_KEY}\n);\n```\n\n**Note:** If you are running your bot in `--local` mode, you won't need the `Request::downloadFile()` method, since you can then access your files directly from the absolute path returned by `Request::getFile()`.\n\n## Webhook installation\n\nNote: For a more detailed explanation, head over to the [example-bot repository] and follow the instructions there.\n\nIn order to set a [Webhook][api-setwebhook] you need a server with HTTPS and composer support.\n(For a [self signed certificate](#self-signed-certificate) you need to add some extra code)\n\nCreate *[set.php]* with the following contents:\n```php\n\u003c?php\n// Load composer\nrequire __DIR__ . '/vendor/autoload.php';\n\n$bot_api_key  = 'your:bot_api_key';\n$bot_username = 'username_bot';\n$hook_url     = 'https://your-domain/path/to/hook.php';\n\ntry {\n    // Create Telegram API object\n    $telegram = new Longman\\TelegramBot\\Telegram($bot_api_key, $bot_username);\n\n    // Set webhook\n    $result = $telegram-\u003esetWebhook($hook_url);\n    if ($result-\u003eisOk()) {\n        echo $result-\u003egetDescription();\n    }\n} catch (Longman\\TelegramBot\\Exception\\TelegramException $e) {\n    // log telegram errors\n    // echo $e-\u003egetMessage();\n}\n```\n\nOpen your *set.php* via the browser to register the webhook with Telegram.\nYou should see `Webhook was set`.\n\nNow, create *[hook.php]* with the following contents:\n```php\n\u003c?php\n// Load composer\nrequire __DIR__ . '/vendor/autoload.php';\n\n$bot_api_key  = 'your:bot_api_key';\n$bot_username = 'username_bot';\n\ntry {\n    // Create Telegram API object\n    $telegram = new Longman\\TelegramBot\\Telegram($bot_api_key, $bot_username);\n\n    // Handle telegram webhook request\n    $telegram-\u003ehandle();\n} catch (Longman\\TelegramBot\\Exception\\TelegramException $e) {\n    // Silence is golden!\n    // log telegram errors\n    // echo $e-\u003egetMessage();\n}\n```\n\n### Self Signed Certificate\n\nUpload the certificate and add the path as a parameter in *set.php*:\n```php\n$result = $telegram-\u003esetWebhook($hook_url, ['certificate' =\u003e '/path/to/certificate']);\n```\n\n### Unset Webhook\n\nEdit *[unset.php]* with your bot credentials and execute it.\n\n## getUpdates installation\n\nFor best performance, the MySQL database should be enabled for the `getUpdates` method!\n\nCreate *[getUpdatesCLI.php]* with the following contents:\n```php\n#!/usr/bin/env php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n\n$bot_api_key  = 'your:bot_api_key';\n$bot_username = 'username_bot';\n\n$mysql_credentials = [\n   'host'     =\u003e 'localhost',\n   'port'     =\u003e 3306, // optional\n   'user'     =\u003e 'dbuser',\n   'password' =\u003e 'dbpass',\n   'database' =\u003e 'dbname',\n];\n\ntry {\n    // Create Telegram API object\n    $telegram = new Longman\\TelegramBot\\Telegram($bot_api_key, $bot_username);\n\n    // Enable MySQL\n    $telegram-\u003eenableMySql($mysql_credentials);\n\n    // Handle telegram getUpdates request\n    $telegram-\u003ehandleGetUpdates();\n} catch (Longman\\TelegramBot\\Exception\\TelegramException $e) {\n    // log telegram errors\n    // echo $e-\u003egetMessage();\n}\n```\n\nNext, give the file permission to execute:\n```bash\n$ chmod +x getUpdatesCLI.php\n```\n\nLastly, run it!\n```bash\n$ ./getUpdatesCLI.php\n```\n\n### getUpdates without database\n\nIf you choose to / or are obliged to use the `getUpdates` method without a database, you can replace the `$telegram-\u003eenableMySql(...);` line above with:\n```php\n$telegram-\u003euseGetUpdatesWithoutDatabase();\n```\n\n## Filter Update\n\n:exclamation: Note that by default, Telegram will send any new update types that may be added in the future. This may cause commands that don't take this into account to break!\n\nIt is suggested that you specifically define which update types your bot can receive and handle correctly.\n\nYou can define which update types are sent to your bot by defining them when setting the [webhook](#webhook-installation) or passing an array of allowed types when using [getUpdates](#getupdates-installation).\n\n```php\nuse Longman\\TelegramBot\\Entities\\Update;\n\n// For all update types currently implemented in this library:\n// $allowed_updates = Update::getUpdateTypes();\n\n// Define the list of allowed Update types manually:\n$allowed_updates = [\n    Update::TYPE_MESSAGE,\n    Update::TYPE_CHANNEL_POST,\n    // etc.\n];\n\n// When setting the webhook.\n$telegram-\u003esetWebhook($hook_url, ['allowed_updates' =\u003e $allowed_updates]);\n\n// When handling the getUpdates method.\n$telegram-\u003ehandleGetUpdates(['allowed_updates' =\u003e $allowed_updates]);\n```\n\nAlternatively, Update processing can be allowed or denied by defining a custom update filter.\n\nLet's say we only want to allow messages from a user with ID `428`, we can do the following before handling the request:\n\n```php\n$telegram-\u003esetUpdateFilter(function (Update $update, Telegram $telegram, \u0026$reason = 'Update denied by update_filter') {\n    $user_id = $update-\u003egetMessage()-\u003egetFrom()-\u003egetId();\n    if ($user_id === 428) {\n        return true;\n    }\n\n    $reason = \"Invalid user with ID {$user_id}\";\n    return false;\n});\n```\n\nThe reason for denying an update can be defined with the `$reason` parameter. This text gets written to the debug log.\n\n## Support\n\n### Types\n\nAll types are implemented according to Telegram API 7.1 (February 2024).\n\n### Inline Query\n\nFull support for inline query according to Telegram API 7.1 (February 2024).\n\n### Methods\n\nAll methods are implemented according to Telegram API 7.1 (February 2024).\n\n#### Send Message\n\nMessages longer than 4096 characters are split up into multiple messages.\n\n```php\n$result = Request::sendMessage([\n    'chat_id' =\u003e $chat_id,\n    'text'    =\u003e 'Your utf8 text 😜 ...',\n]);\n```\n\n#### Send Photo\n\nTo send a local photo, add it properly to the `$data` parameter using the file path:\n\n```php\n$result = Request::sendPhoto([\n    'chat_id' =\u003e $chat_id,\n    'photo'   =\u003e Request::encodeFile('/path/to/pic.jpg'),\n]);\n```\n\nIf you know the `file_id` of a previously uploaded file, just use it directly in the data array:\n\n```php\n$result = Request::sendPhoto([\n    'chat_id' =\u003e $chat_id,\n    'photo'   =\u003e 'AAQCCBNtIhAoAAss4tLEZ3x6HzqVAAqC',\n]);\n```\n\nTo send a remote photo, use the direct URL instead:\n\n```php\n$result = Request::sendPhoto([\n    'chat_id' =\u003e $chat_id,\n    'photo'   =\u003e 'https://example.com/path/to/pic.jpg',\n]);\n```\n\n*sendAudio*, *sendDocument*, *sendAnimation*, *sendSticker*, *sendVideo*, *sendVoice* and *sendVideoNote* all work in the same way, just check the [API documentation](https://core.telegram.org/bots/api#sendphoto) for the exact usage.\nSee the *[ImageCommand.php]* for a full example.\n\n#### Send Chat Action\n\n```php\nRequest::sendChatAction([\n    'chat_id' =\u003e $chat_id,\n    'action'  =\u003e Longman\\TelegramBot\\ChatAction::TYPING,\n]);\n```\n\n#### getUserProfilePhoto\n\nRetrieve the user photo. (see *[WhoamiCommand.php]* for a full example)\n\n#### getFile and downloadFile\n\nGet the file path and download it. (see *[WhoamiCommand.php]* for a full example)\n\n#### Send message to all active chats\n\nTo do this you have to enable the MySQL connection.\nHere's an example of use (check [`DB::selectChats()`][DB::selectChats] for parameter usage):\n\n```php\n$results = Request::sendToActiveChats(\n    'sendMessage', // Callback function to execute (see Request.php methods)\n    ['text' =\u003e 'Hey! Check out the new features!!'], // Param to evaluate the request\n    [\n        'groups'      =\u003e true,\n        'supergroups' =\u003e true,\n        'channels'    =\u003e false,\n        'users'       =\u003e true,\n    ]\n);\n```\n\nYou can also broadcast a message to users, from the private chat with your bot. Take a look at the [admin commands](#admin-commands) below.\n\n## Utils\n\n### MySQL storage (Recommended)\n\nIf you want to save messages/users/chats for further usage in commands, create a new database (`utf8mb4_unicode_520_ci`), import *[structure.sql]* and enable MySQL support BEFORE `handle()` method:\n\n```php\n$mysql_credentials = [\n   'host'     =\u003e 'localhost',\n   'port'     =\u003e 3306, // optional\n   'user'     =\u003e 'dbuser',\n   'password' =\u003e 'dbpass',\n   'database' =\u003e 'dbname',\n];\n\n$telegram-\u003eenableMySql($mysql_credentials);\n```\n\nYou can set a custom prefix to all the tables while you are enabling MySQL:\n\n```php\n$telegram-\u003eenableMySql($mysql_credentials, $bot_username . '_');\n```\n\nYou can also store inline query and chosen inline query data in the database.\n\n#### External Database connection\n\nIt is possible to provide the library with an external MySQL PDO connection.\nHere's how to configure it:\n\n```php\n$telegram-\u003eenableExternalMySql($external_pdo_connection);\n//$telegram-\u003eenableExternalMySql($external_pdo_connection, $table_prefix)\n```\n### Channels Support\n\nAll methods implemented can be used to manage channels.\nWith [admin commands](#admin-commands) you can manage your channels directly with your bot private chat.\n\n## Commands\n\n### Predefined Commands\n\nThe bot is able to recognise commands in a chat with multiple bots (/command@mybot).\n\nIt can also execute commands that get triggered by events, so-called Service Messages.\n\n### Custom Commands\n\nMaybe you would like to develop your own commands.\nThere is a guide to help you [create your own commands][wiki-create-your-own-commands].\n\nAlso, be sure to have a look at the [example commands][ExampleCommands-folder] to learn more about custom commands and how they work.\n\nYou can add your custom commands in different ways:\n\n```php\n// Add a folder that contains command files\n$telegram-\u003eaddCommandsPath('/path/to/command/files');\n//$telegram-\u003eaddCommandsPaths(['/path/to/command/files', '/another/path']);\n\n// Add a command directly using the class name\n$telegram-\u003eaddCommandClass(MyCommand::class);\n//$telegram-\u003eaddCommandClasses([MyCommand::class, MyOtherCommand::class]);\n```\n\n### Commands Configuration\n\nWith this method you can set some command specific parameters, for example:\n\n```php\n// Google geocode/timezone API key for /date command\n$telegram-\u003esetCommandConfig('date', [\n    'google_api_key' =\u003e 'your_google_api_key_here',\n]);\n\n// OpenWeatherMap API key for /weather command\n$telegram-\u003esetCommandConfig('weather', [\n    'owm_api_key' =\u003e 'your_owm_api_key_here',\n]);\n```\n\n### Admin Commands\n\nEnabling this feature, the bot admin can perform some super user commands like:\n- List all the chats started with the bot */chats*\n- Clean up old database entries */cleanup*\n- Show debug information about the bot */debug*\n- Send message to all chats */sendtoall*\n- Post any content to your channels */sendtochannel*\n- Inspect a user or a chat with */whois*\n\nTake a look at all default admin commands stored in the *[src/Commands/AdminCommands/][AdminCommands-folder]* folder.\n\n#### Set Admins\n\nYou can specify one or more admins with this option:\n\n```php\n// Single admin\n$telegram-\u003eenableAdmin(your_telegram_user_id);\n\n// Multiple admins\n$telegram-\u003eenableAdmins([\n    your_telegram_user_id,\n    other_telegram_user_id,\n]);\n```\nTelegram user id can be retrieved with the *[/whoami][WhoamiCommand.php]* command.\n\n#### Channel Administration\n\nTo enable this feature follow these steps:\n- Add your bot as channel administrator, this can be done with any Telegram client.\n- Enable admin interface for your user as explained in the admin section above.\n- Enter your channel name as a parameter for the *[/sendtochannel][SendtochannelCommand.php]* command:\n```php\n$telegram-\u003esetCommandConfig('sendtochannel', [\n    'your_channel' =\u003e [\n        '@type_here_your_channel',\n    ]\n]);\n```\n- If you want to manage more channels:\n```php\n$telegram-\u003esetCommandConfig('sendtochannel', [\n    'your_channel' =\u003e [\n        '@type_here_your_channel',\n        '@type_here_another_channel',\n        '@and_so_on',\n    ]\n]);\n```\n- Enjoy!\n\n## Upload and Download directory path\n\nTo use the Upload and Download functionality, you need to set the paths with:\n```php\n$telegram-\u003esetDownloadPath('/your/path/Download');\n$telegram-\u003esetUploadPath('/your/path/Upload');\n```\n\n## Documentation\n\nTake a look at the repo [Wiki] for further information and tutorials!\nFeel free to improve!\n\n## Assets\n\nAll project assets can be found in the [assets](https://github.com/php-telegram-bot/assets) repository.\n\n## Example bot\n\nWe're busy working on a full A-Z example bot, to help get you started with this library and to show you how to use all its features.\nYou can check the progress of the [example-bot repository]).\n\n## Projects with this library\n\nHere's a list of projects that feats this library, feel free to add yours!\n- [Inline Games](https://github.com/jacklul/inlinegamesbot) ([@inlinegamesbot](https://telegram.me/inlinegamesbot))\n- [Super-Dice-Roll](https://github.com/RafaelDelboni/Super-Dice-Roll) ([@superdiceroll_bot](https://telegram.me/superdiceroll_bot))\n- [tg-mentioned-bot](https://github.com/gruessung/tg-mentioned-bot)\n- [OSMdeWikiBot](https://github.com/OSM-de/TelegramWikiBot) ([@OSM_de](https://t.me/OSM_de))\n- [pass-generator-webbot](https://github.com/OxMohsen/pass-generator-webbot)\n- [Chess Quiz Bot](https://github.com/1int/chess-quiz-bot)\n- [PHP Telegram Bot - Symfony Bundle](https://github.com/m4n50n/telegram_bot_bundle)\n\n## Troubleshooting\n\nIf you like living on the edge, please report any bugs you find on the [PHP Telegram Bot issues][issues] page.\n\n## Contributing\n\nSee [CONTRIBUTING](CONTRIBUTING.md) for more information.\n\n## Security\n\nSee [SECURITY](SECURITY.md) for more information.\n\n## Donate\n\nAll work on this bot consists of many hours of coding during our free time, to provide you with a Telegram Bot library that is easy to use and extend.\nIf you enjoy using this library and would like to say thank you, donations are a great way to show your support.\n\nDonations are invested back into the project :+1:\n\nThank you for keeping this project alive :pray:\n\n- [![Patreon](https://user-images.githubusercontent.com/9423417/59235980-a5fa6b80-8be3-11e9-8ae7-020bc4ae9baa.png) Patreon.com/phptelegrambot][Patreon]\n- [![OpenCollective](https://user-images.githubusercontent.com/9423417/59235978-a561d500-8be3-11e9-89be-82ec54be1546.png) OpenCollective.com/php-telegram-bot][OpenCollective]\n- [![Ko-fi](https://user-images.githubusercontent.com/9423417/59235976-a561d500-8be3-11e9-911d-b1908c3e6a33.png) Ko-fi.com/phptelegrambot][Ko-fi]\n- [![Tidelift](https://user-images.githubusercontent.com/9423417/59235982-a6930200-8be3-11e9-8ac2-bfb6991d80c5.png) Tidelift.com/longman/telegram-bot][Tidelift]\n- [![Liberapay](https://user-images.githubusercontent.com/9423417/59235977-a561d500-8be3-11e9-9d16-bc3b13d3ceba.png) Liberapay.com/PHP-Telegram-Bot][Liberapay]\n- [![PayPal](https://user-images.githubusercontent.com/9423417/59235981-a5fa6b80-8be3-11e9-9761-15eb7a524cb0.png) PayPal.me/noplanman][PayPal-noplanman] (account of @noplanman)\n- [![Bitcoin](https://user-images.githubusercontent.com/9423417/59235974-a4c93e80-8be3-11e9-9fde-260c821b6eae.png) 166NcyE7nDxkRPWidWtG1rqrNJoD5oYNiV][Bitcoin]\n- [![Ethereum](https://user-images.githubusercontent.com/9423417/59235975-a4c93e80-8be3-11e9-8762-7a47c62c968d.png) 0x485855634fa212b0745375e593fAaf8321A81055][Ethereum]\n\n## For enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of `PHP Telegram Bot` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.][Tidelift]\n\n## License\n\nPlease see the [LICENSE](LICENSE) included in this repository for a full copy of the MIT license, which this project is licensed under.\n\n## Credits\n\nCredit list in [CREDITS](CREDITS)\n\n---\n\n[Telegram Bot API]: https://core.telegram.org/bots/api \"Telegram Bot API\"\n[Composer]: https://getcomposer.org/ \"Composer\"\n[run their own Bot API server]: https://core.telegram.org/bots/api#using-a-local-bot-api-server \"Using a Local Bot API Server\"\n[example-bot repository]: https://github.com/php-telegram-bot/example-bot \"Example Bot repository\"\n[api-setwebhook]: https://core.telegram.org/bots/api#setwebhook \"Webhook on Telegram Bot API\"\n[set.php]: https://github.com/php-telegram-bot/example-bot/blob/master/set.php \"example set.php\"\n[unset.php]: https://github.com/php-telegram-bot/example-bot/blob/master/unset.php \"example unset.php\"\n[hook.php]: https://github.com/php-telegram-bot/example-bot/blob/master/hook.php \"example hook.php\"\n[getUpdatesCLI.php]: https://github.com/php-telegram-bot/example-bot/blob/master/getUpdatesCLI.php \"example getUpdatesCLI.php\"\n[AdminCommands-folder]: https://github.com/php-telegram-bot/core/tree/master/src/Commands/AdminCommands \"Admin commands folder\"\n[ExampleCommands-folder]: https://github.com/php-telegram-bot/example-bot/blob/master/Commands \"Example commands folder\"\n[ImageCommand.php]: https://github.com/php-telegram-bot/example-bot/blob/master/Commands/Other/ImageCommand.php \"example /image command\"\n[WhoamiCommand.php]: https://github.com/php-telegram-bot/example-bot/blob/master/Commands/WhoamiCommand.php \"example /whoami command\"\n[HelpCommand.php]: https://github.com/php-telegram-bot/example-bot/blob/master/Commands/HelpCommand.php \"example /help command\"\n[SendtochannelCommand.php]: https://github.com/php-telegram-bot/core/blob/master/src/Commands/AdminCommands/SendtochannelCommand.php \"/sendtochannel admin command\"\n[DB::selectChats]: https://github.com/php-telegram-bot/core/blob/0.70.0/src/DB.php#L1148 \"DB::selectChats() parameters\"\n[structure.sql]: https://github.com/php-telegram-bot/core/blob/master/structure.sql \"DB structure for importing\"\n[Wiki]: https://github.com/php-telegram-bot/core/wiki \"PHP Telegram Bot Wiki\"\n[wiki-create-your-own-commands]: https://github.com/php-telegram-bot/core/wiki/Create-your-own-commands \"Create your own commands\"\n[issues]: https://github.com/php-telegram-bot/core/issues \"PHP Telegram Bot Issues\"\n\n[Patreon]: https://www.patreon.com/phptelegrambot \"Support us on Patreon\"\n[OpenCollective]: https://opencollective.com/php-telegram-bot \"Support us on Open Collective\"\n[Ko-fi]: https://ko-fi.com/phptelegrambot \"Support us on Ko-fi\"\n[Tidelift]: https://tidelift.com/subscription/pkg/packagist-longman-telegram-bot?utm_source=packagist-longman-telegram-bot\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo \"Learn more about the Tidelift Subscription\"\n[Liberapay]: https://liberapay.com/PHP-Telegram-Bot \"Donate with Liberapay\"\n[PayPal-noplanman]: https://paypal.me/noplanman \"Donate with PayPal\"\n[Bitcoin]: https://www.blockchain.com/btc/address/166NcyE7nDxkRPWidWtG1rqrNJoD5oYNiV \"Donate with Bitcoin\"\n[Ethereum]: https://etherscan.io/address/0x485855634fa212b0745375e593fAaf8321A81055 \"Donate with Ethereum\"\n","funding_links":["https://tidelift.com/badges/github/php-telegram-bot/core?style=flat","https://www.patreon.com/phptelegrambot","https://opencollective.com/php-telegram-bot","https://ko-fi.com/phptelegrambot","https://tidelift.com/subscription/pkg/packagist-longman-telegram-bot?utm_source=packagist-longman-telegram-bot\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo","https://liberapay.com/PHP-Telegram-Bot","https://paypal.me/noplanman"],"categories":["Bot Libraries","PHP","Telegram Libraries","Bots","Libraries"],"sub_categories":["PHP","Unofficial","Bot Libs","Telegram"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-telegram-bot%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-telegram-bot%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-telegram-bot%2Fcore/lists"}