{"id":18699759,"url":"https://github.com/hctilg/telebot","last_synced_at":"2025-07-14T16:05:16.418Z","repository":{"id":174270603,"uuid":"651898283","full_name":"hctilg/telebot","owner":"hctilg","description":"The Library for Build a Telegram Bot.","archived":false,"fork":false,"pushed_at":"2025-07-13T17:06:31.000Z","size":53,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-13T18:38:57.631Z","etag":null,"topics":["library","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hctilg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-10T12:36:30.000Z","updated_at":"2025-07-13T17:03:29.000Z","dependencies_parsed_at":"2024-07-21T08:32:55.600Z","dependency_job_id":null,"html_url":"https://github.com/hctilg/telebot","commit_stats":null,"previous_names":["hctilg/telebot"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/hctilg/telebot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hctilg%2Ftelebot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hctilg%2Ftelebot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hctilg%2Ftelebot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hctilg%2Ftelebot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hctilg","download_url":"https://codeload.github.com/hctilg/telebot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hctilg%2Ftelebot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265314191,"owners_count":23745215,"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":["library","telegram-bot-api"],"created_at":"2024-11-07T11:34:19.278Z","updated_at":"2025-07-14T16:05:16.395Z","avatar_url":"https://github.com/hctilg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telebot\n\nThe Library for Build a Telegram Bot.\n\n### Requirements\n+ php-curl  \u003c!-- sudo apt-get install php-curl --\u003e\n\n## Get Started\n\n```php\n// Checking the exists \"Telebot Library\".\nif (!file_exists(\"telebot.php\")) {\n  copy(\"https://raw.githubusercontent.com/hctilg/telebot/v2.2/index.php\", \"telebot.php\");\n}\n\nrequire('telebot.php');\n\n$bot = new Telebot('TOKEN');\n\n// codes\n\n$bot-\u003erun();\n```\n\n## Use\n\n```php\n/**\n * for example: \n *  $bot($method, $args);\n */\n$bot('sendMessage', ['chat_id'=\u003e $chat_id, 'text'=\u003e $text]);\n```\n\n Or\n\n```php\n/**\n * for example: \n *  $bot-\u003e$method($args);\n */\n$bot-\u003esendMessage(['chat_id'=\u003e $chat_id, 'text'=\u003e $text]);\n```\n\n## Event Handler\n```php\n/**\n * all events\n * for example: \n *  $bot-\u003eon('all' or '*', function($type, $data) use ($bot, $args..) { ... });\n */\n$bot-\u003eon('*', function($type, $data) use ($bot) {\n  $chat_id = $data['chat']['id'];\n  $bot-\u003esendMessage(['chat_id'=\u003e $chat_id, 'text'=\u003e \"$type\\n\\n\" . json_encode($data)]);\n});\n\n/**\n * one event\n * for example: \n *  $bot-\u003eon($ev_type, function($data) use ($bot, $args..) { ... });\n */\n$bot-\u003eon('text', function($data) use ($bot) {\n  $chat_id = $data['chat']['id'];\n  $text = $data['text'];\n  $bot-\u003esendMessage(['chat_id'=\u003e $chat_id, 'text'=\u003e \"Parrot: $text\"]);\n});\n```\n\n## Example\n\na few examples..\n\n## SendMessage\n```php\n$chat_id = $data['chat']['id'];\n$name = $data['chat']['first_name'];\n$bot-\u003esendMessage([\n  'chat_id'=\u003e $chat_id,\n  'text'=\u003e \"Hello $name\",\n  'parse_mode'=\u003e 'Markdown'\n]);\n```\n\n## DownloadFile\n```php\n$bot-\u003edownload($file_id, $file_path);\n```\n\n## SendDocument\n```php\n$chat_id = $data['chat']['id'];\n$bot-\u003esendDocument([\n  'chat_id'=\u003e $chat_id,\n  'document'=\u003e 'file.zip',\n  'caption'=\u003e 'this is a caption.'\n]);\n```\n\n## SendPhoto\n```php\n$chat_id = $data['chat']['id'];\n$bot-\u003esendPhoto([\n  'chat_id'=\u003e $chat_id,\n  'photo'=\u003e 'image.jpg',\n  'caption'=\u003e 'this is a caption.'\n]);\n```\n\n## Keyboard Button\n```php\n$bot-\u003eon('text', function($data) use ($bot) {\n  $chat_id = $data['chat']['id'];\n  $text = $data['text'];\n\n  $keyboard_btn = Telebot::keyboard(\"\n    [Help]\n    [Share Phone Number|request_contact] [Share Location|request_location]\n  \");\n\n  $bot-\u003esendMessage([\n    'chat_id'=\u003e $chat_id,\n    'text'=\u003e \"Keyboard Buttons :\",\n    'reply_markup'=\u003e $keyboard_btn\n  ]);\n\n  if ($text == 'Help') {\n    $bot-\u003esendMessage([\n      'chat_id'=\u003e$chat_id,\n      'text'=\u003e \"Help Text Here\",\n      'disable_web_page_preview'=\u003e true\n    ]);\n  }\n});\n\n$bot-\u003eon('contact', function($data) use ($bot) {\n  $chat_id = $data['chat']['id'];\n  $contact = $data['contact'];\n  $phone_number = $contact['phone_number'];\n\n  $bot-\u003esendMessage([\n    'chat_id'=\u003e$chat_id,\n    'text'=\u003e \"Phone Number: $phone_number\"\n  ]);\n});\n```\n\n## Inline Keyboard Button\n```php\n$bot-\u003eon('text', function($data) use ($bot) {\n  $chat_id = $data['chat']['id'];\n  $text = $data['text'];\n\n  $inline_btn = Telebot::inline_keyboard(\"\n    [Dialog|show_dialog] [Toast|show_toast]\n    [SIQ|switch_inline_query:query] [SIQC|switch_inline_query_current_chat:query]\n    [GitHub|url:https://github.com/hctilg/telebot]\n    [Telebot is a php-library for building Telegram bots.|copy_text:Copy in Clipboard]\n  \");\n\n  $bot-\u003esendMessage([\n    'chat_id'=\u003e $chat_id,\n    'text'=\u003e \"Inline Keyboard Buttons :\",\n    'reply_markup'=\u003e $inline_btn\n  ]);\n});\n\n$bot-\u003eon('callback_query', function($callback_query) use ($bot) {\n  $callback_query_id = $callback_query['id'];\n  $callback_query_data = $callback_query['data'];\n  $callback_query_chat_id = $callback_query['message']['chat']['id'];\n\n  if ($callback_query_data == 'show_dialog') {\n    $bot-\u003eanswerCallbackQuery([\n      'callback_query_id'=\u003e $callback_query_id,\n      'text'=\u003e 'Dialog Text Here.',\n      'show_alert'=\u003e true\n    ]);\n  } elseif ($callback_query_data == 'show_toast') {\n    $bot-\u003eanswerCallbackQuery([\n      'callback_query_id'=\u003e $callback_query_id,\n      'text'=\u003e 'Toast Text Here.',\n      'show_alert'=\u003e false\n    ]);\n  }\n});\n```\n\n#### [Telegram Bot API](https://core.telegram.org/bots/api)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhctilg%2Ftelebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhctilg%2Ftelebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhctilg%2Ftelebot/lists"}