steadfast/telegram-bot-api 问题修复 & 功能扩展

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

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

steadfast/telegram-bot-api

Composer 安装命令:

composer require steadfast/telegram-bot-api

包简介

Telegram Bot API written in PHP

README 文档

README

Latest Stable Version Total Downloads License

An extended native Telegram Bot API in PHP without requirements. Supports all methods and types of responses.

Installation

composer require steadfast/telegram-bot-api

Client usage

How to send message:

use TelegramBot\Api\BotApi;

$bot = new BotApi($bot_api_token);

$bot->sendMessage($chat_id, $message_text);

Server usage

To handle commands:

use TelegramBot\Api\Client;

$bot = new Client($bot_api_token);

$bot->command('ping', function ($message) use ($bot) {
    $bot->sendMessage($message->getChat()->getId(), 'pong!');
});

To handle an event when the bot was added to a group:

use TelegramBot\Api\Client;

$bot = new Client($bot_api_token);

$bot->wasAddedToAGroup(function ($message) use ($bot) {
    $bot->sendMessage($message->getChat()->getId(), "Let's welcome our new member!");
});

To handle an event when the bot was removed from a group:

use TelegramBot\Api\Client;

$bot = new Client($bot_api_token);

$bot->wasRemovedFromAGroup(function ($message) use ($bot) {
    $bot->sendMessage($message->getChat()->getId(), "Say goodbye to our friend!");
});

To handle any events:

use TelegramBot\Api\Client;

$bot = new Client($bot_api_token);

$bot->on(function ($update) {
    echo $update->getUpdateId();
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固