smartnode / telebot

Telegram Bot API in C
https://elmurod.net/telebot
Apache License 2.0
162 stars 38 forks source link

Telebot does not provide API result to user #44

Closed p4vook closed 2 years ago

ozbek commented 4 years ago

Hi!

Can you elaborate more, please? An example would also be great.

gaboflowers commented 3 years ago

I'm not sure if it's the same thing, but debugging my own bots I noticed Telebot didn't give me the error feedbacks Telegram was providing.

To overcome this, I modified my local Telebot library at several points. For instance, in file telebot-core.c to show the info if there is any, it becomes:

if (resp->data)
    ERR("Wrong HTTP response received, response: %ld; error: %s", resp_code, resp->data /* This was not in the original */);
else /* Original line */
p4vook commented 3 years ago

For example, the forward request in API returns forwarded message id. And this info is very important for my application.

smartnode commented 3 years ago

I'm not sure if it's the same thing, but debugging my own bots I noticed Telebot didn't give me the error feedbacks Telegram was providing.

To overcome this, I modified my local Telebot library at several points. For instance, in file telebot-core.c to show the info if there is any, it becomes:

if (resp->data)
    ERR("Wrong HTTP response received, response: %ld; error: %s", resp_code, resp->data /* This was not in the original */);
else /* Original line */

@gaboflowers You are welcome to create pull request for the patch you created.

smartnode commented 3 years ago

@pavel-the-best Indeed, telebot does NOT provide response, but only error codes. I've not considered those case, and maybe I will update in the future. If you have ready patch you are welcome to create PR.