0

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

  1. 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 ?!

  1. I uploaded all the files and used the example-bot repository for set.php and hook.php and i uploaded these files in vendor/longman/telegram-bot/src.

  2. In step 3, i created my robot in botfather.

  3. Next, i edit set.php and hook.php for my robot and i used https://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 ?

irmmr
  • 39
  • 1
  • 7
  • I don't think the given error message is connected to the bot itself, but to missing files. And in the given repository, I cannot find anything in the given file that could cause that error. Are you sure you are using the proper autoloader? – Nico Haase Mar 10 '20 at 09:44
  • Yes I did call it all from Composer. You can try `composer require longman/telegram-bot`. i didn't edit other files! – irmmr Mar 10 '20 at 10:23
  • No one can help ?! – irmmr Mar 10 '20 at 12:46

0 Answers0