I have a Telegram BOT running, fetching messages from a DB and sending them into a channel. These messages actually consist of 2 messages, the first is a map (location), the second is a text message. If the next message contains the same location, the previous message is deleted and the updated is placed.
When posting 'single' messages, this works like a charm. However (this wasn't the core reason for this posting), sometimes the message is posted first and the location second. No clue what that is causing, I have a delay node between function and Telegram sender node of 1 second.
But, long story short, I'm changing my code into a loop, since I was missing some messages if more are sent in a short period. Now I SELECT the last xx entries from DB and looping though them, sending all messages newer than when checking in the last loop. No comes the messy part. All code is executed directly, but buffered / delayed by the delay node. When trying to delete the previous message, this ID was not known (yet) when executing the code. Resulting in the location not being deleted. I tried to workaround via setTimeout, but this doesn't seem to be allowed in a for loop.
Any suggestions maybe?