-
-
Notifications
You must be signed in to change notification settings - Fork 66
Migrating from core to manager
Armando Lüscher edited this page May 21, 2020
·
1 revision
So, you'd like to move from the classic core library to the manager?
This is very easy and can be done in a few simple steps, which apply for both webhook and getUpdates methods.
- You will need to change your
composer.json
to require the manager and update the version of the core library (replace<version>
with the version of core you'd like). Add these two entries to yourcomposer.json
:"longman/telegram-bot": "<version> as 0.59"
"php-telegram-bot/telegram-bot-manager": "^1.5"
- Run
composer update
to fetch the manager and update the core library. - Take a look at the
example-bot
repo and get a copy ofmanager.php
. - Your
set.php
,unset.php
andhook.php
will all be managed by the same file (in this examplemanager.php
). - Move all variables that you have set in your
hook.php
into the new array format of the manager. (see list of all options) - After setting all necessary values, you will need to reset the webhook to point to your new
manager.php
, via your CLI execute:php manager.php a=reset
- Your new webhook should now be set and the bot should work as before, well done!
- Check the webhook via CLI:
php manager.php a=webhookinfo
- Check the webhook via CLI:
The most important change from hook.php
to manager.php
is the added layer of security, which allows only Telegram servers to access the script from the internet and a necessary secret
that is defined in the config.
To modify any extra behaviour, be sure to read the full README