Closed FBMinis closed 4 weeks ago
Hi @FBMinis
You are sending photo using this method:
inline bool sendPhoto(int64_t chat_id, uint8_t *data, size_t size, const char *caption = nullptr)
As you can see, caption is already supported but actually null as default. So you can prepare your timestamp string just before sending the message and include it.
char caption_str[20];
time_t now = time(nullptr);
tInfo = *localtime(&now);
strftime(caption_str, sizeof(caption_str), "%d/%m/%Y %H:%M:%S", &tInfo);
myBot.sendPhoto(userid, fb->buf, fb->len, caption_str);
Working perfectly, thank you!
char caption_str[20];
struct tm tInfo;
time_t now = time(nullptr);
tInfo = *localtime(&now);
strftime(caption_str, sizeof(caption_str), "%d/%m/%Y %H:%M:%S", &tInfo);
myBot.sendPhoto(userid, fb->buf, fb->len, caption_str);
Hi Tolentino,
I have been using your library for almost 3 years, thank you for sharing your work. I modified one of the examples so my battery powered ESP32CAMs turn ON and send a photo, either using PIR as a trigger or a DS3231 to define the interval of time. One of them as sent me more than 3000 photos since I last charge the battery, the connection to Telegram works perfectly.
I would like the photo to include a caption, which would be a variable with a timestamp, previously stored in LittleFS. How do you add a caption to a photo?
The following code is what I use to send a photo to my Telegram account when I power ON the device: