Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/radyakaze/telebot
TeleBot - Simple PHP Telegram Bot
https://github.com/radyakaze/telebot
Last synced: about 2 months ago
JSON representation
TeleBot - Simple PHP Telegram Bot
- Host: GitHub
- URL: https://github.com/radyakaze/telebot
- Owner: radyakaze
- License: other
- Created: 2015-08-15T05:44:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-11T13:48:43.000Z (about 8 years ago)
- Last Synced: 2024-10-11T12:48:36.315Z (2 months ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deprecated
This package is deprecated, please use [PHPTelebot](https://github.com/radyakaze/phptelebot) instead of. It's newer and better.
# TeleBot - PHP Telegram BotA Simple Telegram Bot based on the official [Telegram Bot API](https://core.telegram.org/bots/api)
## Requirements
* PHP 5.3+
* Telegram Bot API Access Token - Talk to [@BotFather](http://telegram.me/BotFather) and generate one. [Documentation](https://core.telegram.org/bots#botfather).## Installation
#### Install Through Composer
You can either add the package directly by firing this command
```cli
$ composer require radyakaze/telebot
```## Usage
You must set [WebHook](https://core.telegram.org/bots/api#setwebhook)Create set.php and put:
```php
setWebhook('https://domain/path_to_hook.php');
```
And open your set.php via browserAfter create hook.php and put:
```php
Hello world!
$tg->cmd('hello', 'Hello world!');// Simple command with parameter : /echo telebot => telebot
$tg->cmd('echo', function($text){
if (isset($text)) {
return $text;
} else {
return '/echo ';
}
});
$tg->run();
```#### Send Photo
```php
$tg->cmd('upload', array(
'type' => 'photo',
'send' => 'path/to/photo.jpg'
);
// OR
$tg->cmd('upload2', function($text) {
return array(
'type' => 'photo',
'send' => 'path/to/photo.jpg'
)
});
```### Send Location
```php
cmd('myloc', function($text) {
return array(
'type' => 'location',
'send' => array(-7.61, 109.51) // Gombong, Kebumen, Indonesia, you can integrate with google maps api
)
});
```### Avaible Types
* text, optional: web_preview (default: true)
* photo, optional: caption
* video, optional: caption
* document
* audio
* location, required: send as array($latitude, $longitude)## License
TeleBot is under the MIT License## Credits
Created by [Radya][1].
[0]: https://github.com/radya/telebot
[1]: mailto:[email protected]