witnessmenow / Universal-Arduino-Telegram-Bot

Use Telegram on your Arduino (ESP8266 or Wifi-101 boards)
MIT License
1.13k stars 312 forks source link

[question] updating message #109

Open leonardpitzu opened 5 years ago

leonardpitzu commented 5 years ago

is there and api that you can use to update the same message in a loop? think a thermometer where the user makes a request and the "arduino" keeps pushing an updated value until a "stop" command is received.

witnessmenow commented 5 years ago

The telegram bot API supports editing of messages, but it's not currently a feature of this library. It is something I'd like to add but I'm not sure when I'll get time

Edit message is the endpoint, which is really similar to just sending a message

https://core.telegram.org/bots/api#editmessagetext

But the biggest change would be that the library doesn't currently do anything with the response to sending a message, and it would need to to get the id of the message to edit

On Mon, 25 Feb 2019, 16:06 leonardpitzu, notifications@github.com wrote:

is there and api that you can use to update the same message in a loop? think a thermometer where the user makes a request and the "arduino" keeps pushing an updated value until a "stop" command is received.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/issues/109, or mute the thread https://github.com/notifications/unsubscribe-auth/ABfXwiRg86P4FA190DEMA5dbVzD667Klks5vRAoLgaJpZM4bQNwe .

witnessmenow commented 5 years ago

Actually I think I completely missunderstood the question. Just set a Boolean flag in your sketch that if it's set your loop does something with, that is set to false when you send the /stop command

On Mon, 25 Feb 2019, 17:13 Brian Lough, ecenuig@gmail.com wrote:

The telegram bot API supports editing of messages, but it's not currently a feature of this library. It is something I'd like to add but I'm not sure when I'll get time

Edit message is the endpoint, which is really similar to just sending a message

https://core.telegram.org/bots/api#editmessagetext

But the biggest change would be that the library doesn't currently do anything with the response to sending a message, and it would need to to get the id of the message to edit

On Mon, 25 Feb 2019, 16:06 leonardpitzu, notifications@github.com wrote:

is there and api that you can use to update the same message in a loop? think a thermometer where the user makes a request and the "arduino" keeps pushing an updated value until a "stop" command is received.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/issues/109, or mute the thread https://github.com/notifications/unsubscribe-auth/ABfXwiRg86P4FA190DEMA5dbVzD667Klks5vRAoLgaJpZM4bQNwe .

leonardpitzu commented 5 years ago

The first answer was the one i was looking for; the second one I know :-) I patched you lib for getting back the message_id and I try to edit the message but I get back some answer that the message can or be edited. I will call it a night as I’m in the office for 12h and my patching work is worst than usual.

RomeHein commented 4 years ago

Hey, I’ve put together a pull request that add (mostly) that feature:

https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/pull/155

@leonardpitzu, could you confirm that’s what your were looking for?

fritsjan commented 4 years ago

I wanted the same and took #155 as a guide to make a working pull-request from the latest master, tested and I also wrote a working example to show how people can use it, see #190