radyakaze/telebot 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

radyakaze/telebot

最新稳定版本:0.1

Composer 安装命令:

composer require radyakaze/telebot

包简介

TeleBot - Simple PHP Telegram Bot

README 文档

README

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

TeleBot - PHP Telegram Bot

A Simple Telegram Bot based on the official Telegram Bot API

Requirements

Installation

Install Through Composer

You can either add the package directly by firing this command

$ composer require radyakaze/telebot

Usage

You must set WebHook

Create set.php and put:

<?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

After create hook.php and put:

<?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

Credits

Created by Radya.

统计信息

  • 总下载量: 154
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-17