* fix: correct structure of lastMessages in message content * fix: update send_message to store external_created_at timestamp with result from request * fix: filter incoming messages for unread conversation logic * fix: improve extraction of message timestamp in send_message method * feat: enhance message timestamp extraction and update logic in send_message method * refactor: send_message to improve error handling and update external_created_at timestamp * chore: move message timestamp extraction to helper * fix: use message timestamp extract on incoming * fix: update unread_conversation to handle last message correctly for Baileys provider --------- Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
14 lines
422 B
Ruby
14 lines
422 B
Ruby
module BaileysHelper
|
|
def extract_baileys_message_timestamp(timestamp)
|
|
# NOTE: Timestamp might be in this format {"low"=>1748003165, "high"=>0, "unsigned"=>true}
|
|
if timestamp.is_a?(Hash) && timestamp.key?('low')
|
|
low = timestamp['low'].to_i
|
|
high = timestamp.fetch('high', 0).to_i
|
|
return (high << 32) | low
|
|
end
|
|
|
|
# NOTE: Timestamp might be a string or a number
|
|
timestamp.to_i
|
|
end
|
|
end
|