Core: Why is it difficult to work with this project?

Created on 27 Jan 2018  路  3Comments  路  Source: php-telegram-bot/core

Hello . Thank you for this app
But I think it's really hard to work with your code
I myself can create a simple program for a telegram robot. But after reading a few times, I did not get any results from working with this codes.
For example, you explained how to set WebHook or how to prepare the project for getUpdates. Well, how do you do it at all?
How should I test this code on localhost . How should the last person who sent the message send him a message?
I do not know, maybe I got it bad.
Can you give me a complete example?

All 3 comments

https://github.com/php-telegram-bot/example-bot

When developing on localhost you have no other choice but to use getUpdatesCLI.php (continous loop) or manager.php l=300 (loop for 300 seconds using manager helper library).

I saw manager.php file
But I still did not understand how to work.
For example, I want to check by opening a php file. If the last message is hello , My robot respond to the same user hi
How should I do this?

  • I used an intermediate site to circumvent the certificate .
    The only thing I needed to do was to remove 'jsan=' word from the response of file_get_contents('php://input') function ,
    Now can I do the same?

To handle text message use Genericmessage: https://github.com/php-telegram-bot/example-bot/blob/master/Commands/GenericmessageCommand.php

$this->getMessage()->getText(true); will return the text user sent to the bot, now it just a matter of replying back:

php $data = [ 'chat_id' => $message->getChat()->getId(), 'text' => 'Hi' ]; Request::sendMessage($data);

I used an intermediate site to circumvent the certificate .
The only thing I needed to do was to remove 'jsan=' word from the response of >file_get_contents('php://input') function ,
Now can I do the same?

I don't understand what you're trying to achieve here

Was this page helpful?
0 / 5 - 0 ratings