Hi I posted this question on php-telegram-bot/core/issues
in Github but no one answered it!
This Telegram-bot doesn't work for me : longman/telegram-bot
- I used
composer require longman/telegram-bot
for require project :
| vendor --------- > | composer
| composer.json | guzzlehttp
| composer.lock | longman ---> telegram-bot ---> src
| psr
| ralouphie
| autoload.php
Do I have to upload all these files to my host ?!
I uploaded all the files and used the
example-bot
repository forset.php
andhook.php
and i uploaded these files invendor/longman/telegram-bot/src
.In step 3, i created my robot in
botfather
.Next, i edit
set.php
andhook.php
for my robot and i usedhttps://mysite/vendor/longman/telegram-bot/src/set.php
for ser webhook!
By the way, these files are not capable of calling autoload.php file at all. So I changed the file path to the files:
- require_once __DIR__ . '/vendor/autoload.php';
+ require_once __DIR__ . '/../../../autoload.php';
This time I was able to set the webhook but every time i send a /start
to the robot, I get this error on error_log
and the robot does not work:
error_log and the robot does not work:
[09-Mar-2020 16:24:33 UTC] PHP Fatal error: Uncaught Error: Class 'Longman\TelegramBot\Commands\UserCommands\Request' not found in /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/Commands/UserCommands/StartCommand.php:56
Stack trace:
#0 /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/Commands/Command.php(182): Longman\TelegramBot\Commands\UserCommands\StartCommand->execute()
#1 /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/Telegram.php(518): Longman\TelegramBot\Commands\Command->preExecute()
#2 /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/Telegram.php(491): Longman\TelegramBot\Telegram->executeCommand('start')
#3 /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/Telegram.php(416): Longman\TelegramBot\Telegram->processUpdate(Object(Longman\TelegramBot\Entities\Update))
#4 /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/hook.php(69): Longman\TelegramBot\Telegram->handle()
#5 {main}
thrown in /home/mypath/public_html/bot/vendor/longman/telegram-bot/src/Commands/UserCommands/StartCommand.php on line 56
what should I do ?