Closed fedorc closed 1 year ago
Hey @fedorc,
unfortunately, I don't think it's possible, you have to implement it manually somehow. The problem is that Update object itself doesn't provide any date information, only Update's ID. You can try to check Update#current_message
for dates, but this is not 100% reliable because some types (e.g. Message) provide such information, but others (e.g. ChosenInlineResult) don't.
@atipugin , thank you for your reply, it pointed me in a different direction and i was able to solve my need
i used to have, which was pooling old messages
bot.listen do |message|
if message.text.match(/^(\d)+$/) && message.text.size == 5
# do some good stuff
end
end
changed to this, and now its working as i need
time_now = Time.now.to_i
bot.listen do |message|
if (message.date.to_i > time_now) && message.text.match(/^(\d)+$/) && message.text.size == 5
# do some good stuff
end
end
can be closed. thank you
Problem: Once i start a bot, it will go back in a chat history and iterate through all messages which was sent while bot was down/disabled.
What is a way to ignore messages with timestamp which is less than time.now (which is a time when bot was started)
Thank you in advance.