rezident / wise-telegram-bot
dev-master
2023-05-05 09:53 UTC
Requires
- php: ^8.0
- rezident/self-documented-telegram-bot-sdk: ^6.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.14
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-21 18:48:36 UTC
README
Creating the bot
To create a new bot object, you need a token. This token can be obtained with a special bot - @BotFather. Creating a bot object:
$bot = new \Rezident\WiseTelegramBot\Bot('special token');
Processing updates
The bot can receive the update in two ways: by requesting it itself (using the getUpdates method) or by receiving it as an associative array (using webhooks).
Associative array
For the bot to process the update as an associative array,
it must be passed to the handleUpdate
method:
$update = json_decode($body); $bot = new \Rezident\WiseTelegramBot\Bot('special token'); $bot->handleUpdate($update);