feat: add support for telegram circular video messages (#11504)

This PR adds support for handling Telegram's video_note messages (circular video messages), which are commonly used for short voice-style video replies in messaging.

Fixes: #11503

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Uchkun Rakhimov
2025-06-11 02:31:28 +05:00
committed by GitHub
parent 4303007786
commit c0d9533b3a
2 changed files with 48 additions and 4 deletions

View File

@@ -94,13 +94,25 @@ class Telegram::IncomingMessageService
end
def file_content_type
return :image if params[:message][:photo].present? || params.dig(:message, :sticker, :thumb).present?
return :audio if params[:message][:voice].present? || params[:message][:audio].present?
return :video if params[:message][:video].present?
return :image if image_message?
return :audio if audio_message?
return :video if video_message?
file_type(params[:message][:document][:mime_type])
end
def image_message?
params[:message][:photo].present? || params.dig(:message, :sticker, :thumb).present?
end
def audio_message?
params[:message][:voice].present? || params[:message][:audio].present?
end
def video_message?
params[:message][:video].present? || params[:message][:video_note].present?
end
def attach_files
return unless file
@@ -174,6 +186,9 @@ class Telegram::IncomingMessageService
end
def visual_media_params
params[:message][:photo].presence&.last || params.dig(:message, :sticker, :thumb).presence || params[:message][:video].presence
params[:message][:photo].presence&.last ||
params.dig(:message, :sticker, :thumb).presence ||
params[:message][:video].presence ||
params[:message][:video_note].presence
end
end