定制 erfanvahabpour/bale-bot-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

erfanvahabpour/bale-bot-sdk

最新稳定版本:v1.0.5

Composer 安装命令:

composer require erfanvahabpour/bale-bot-sdk

包简介

The Unofficial Bale Bot API PHP SDK

README 文档

README

Bale Bot PHP SDK lets you develop Bale Bots in PHP easily! Supports Laravel out of the box.

Bale Bot API is an HTTP-based interface created for developers keen on building bots for Bale.

To learn more about the Bale Bot API, please consult the Introduction to Bots and Bot FAQ on official Bale site.

To get started writing your bots using this SDK, Please refer the documentation.

Documentation

Documentation for the SDK can be found on the website.

Installation

composer require erfanvahabpour/bale-bot-sdk

Examples

getMe Method

A simple method for testing your bot's auth token.
Returns basic information about the bot in form of a User object.

$Bale = new Api($token);

$response = $Bale->getMe(); // return User object

sendMessage Method

Send text messages.

$Bale = new Api($token);

$response = $Bale->sendMessage([
    'chat_id' => '2100855301',
    'text' => 'This is a text.'
]); // return Message object

sendMessage Method in Laravel

Send text messages.

use EFive\Balle\Laravel\Facades\Bale;

$response = Bale::sendMessage([
    'chat_id' => '2100855301',
    'text' => 'This is a text.'
]); // return Message object

Get first name of a chat

Show the first name of a chat(private chats only)

$Bale = new Api($token);

$response = $Bale->getChat([
    'chat_id' => '2100855301'
]); // return User object

echo $response->getFirstName();

Setting multiple bots

For setting multiple bots in a single application

use EFive\Bale\BotsManager;

$config = [
    'bots' => [
        'firstBot' => [
            'token' => $firstBotToken,
        ],
        'secondBot' => [
            'token' => $secondBotToken,
        ],
    ]
];

$bale = new BotsManager($config);

// getMe Method
$response = $bale->bot('firstBot')->getMe(); // return User object

Disclaimer

This project and its author are neither associated nor affiliated with Bale in any way. Please see the License for more details.

License

This project is released under the BSD 4-Clause License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-4-Clause
  • 更新时间: 2024-11-06