2017 © Pedro Peláez
 

library telebot

TeleBot - Simple PHP Telegram Bot

image

radyakaze/telebot

TeleBot - Simple PHP Telegram Bot

  • Friday, November 11, 2016
  • by radyakaze
  • Repository
  • 1 Watchers
  • 3 Stars
  • 69 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 21 % Grown

The README.md

Deprecated

This package is deprecated, please use PHPTelebot instead of. It's newer and better., (*1)

TeleBot - PHP Telegram Bot

A Simple Telegram Bot based on the official Telegram Bot API, (*2)

Requirements

Installation

Install Through Composer

You can either add the package directly by firing this command, (*3)

$ composer require radyakaze/telebot

Usage

You must set WebHook, (*4)

Create set.php and put:, (*5)

<?php
$token = 'BOT TOKEN';
$botname = 'BOT USERNAME';

require __DIR__.'/vendor/autoload.php';

$tg = new TeleBot\Api($token, $botname);
$tg->setWebhook('https://domain/path_to_hook.php');

And open your set.php via browser, (*6)

After create hook.php and put:, (*7)

<?php
$token = 'BOT TOKEN';
$botname = 'BOT USERNAME';

require __DIR__.'/vendor/autoload.php';

$tg = new TeleBot\Api($token, $botname);

// Simple command : /hello => 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 <text>';
  }
 });

$tg->run();

Send Photo

$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
$tg->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, (*8)

Credits

Created by Radya., (*9)

The Versions

11/11 2016

dev-master

9999999-dev http://github.com/radyakaze/telebot

TeleBot - Simple PHP Telegram Bot

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Radya

api bot sdk telegram

17/08 2015

0.1

0.1.0.0 http://github.com/radyakaze/telebot

TeleBot - Simple PHP Telegram Bot

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Radya

api bot sdk telegram