php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.9k stars 953 forks source link

First response #16

Closed KotovDmitry closed 9 years ago

KotovDmitry commented 9 years ago

When I run the code nothing happens ("Input is empty!") What should I do, what I would write to the bot (for example /newcommand) and he will respone "Hello Dmitry!" ? Please, help me to write my first simple bot app.

akalongman commented 9 years ago

Read README file please. First you must create bot in Telegram via Botfather After you must set webhook

azizimusa commented 9 years ago

I have setup all that, bot, hook and in browser displayed "Webhook was set". After that, I dont have idea how to make it response with bot command.

MBoretto commented 9 years ago

If everything is set properly as you say, type in a chat with your bot: /echo Hello! it should respond to you.

danielberlin commented 9 years ago

I have the same problem.

set.php gives Webhook was not set! Error: (with no error following after "Error:")

However, I can set the web hook manually by directly calling api.telegram.org with curl. Then interacting with my bot results in messages written to mysql table messages

{"id":123344,"title":null,"first_name":"myName","last_name":null,"username":"null","bot_name":null} and column text also contains what I wrote to my bot.

But /echo Hello! doesn't result in any reaction from my bot (I can see the Push POST Request in the server log and in MySQL table messages as described above though). You wrote it should respond, but why doesn't it do that?

It would actually be nice to see a small Hello World example e.g. with the commands already provided in the package (for instance, vendor/longman/telegram-bot/src/Commands/EchoCommand.php) – what I have to add to hooks.php in addition to that explained in README.md to get EchoCommand working.Thanks!

MBoretto commented 9 years ago

Hello, in the latest release I've work around setWebHook and request to the server. I've used setWebhook and it works for me. Let me know if you still recognise this those problems.