rezident/wise-telegram-bot

dev-master 2023-05-05 09:53 UTC

This package is auto-updated.

Last update: 2024-09-21 18:15:34 UTC


README

创建机器人

要创建一个新的机器人对象,您需要一个令牌。这个令牌可以通过特殊的机器人 - @BotFather 获取。创建机器人对象

$bot = new \Rezident\WiseTelegramBot\Bot('special token');

处理更新

机器人可以通过两种方式接收更新:自己请求(使用 getUpdates 方法)或者作为关联数组接收(使用 webhooks)。

关联数组

为了让机器人将更新作为关联数组处理,必须将其传递给 handleUpdate 方法

$update = json_decode($body);

$bot = new \Rezident\WiseTelegramBot\Bot('special token');
$bot->handleUpdate($update);