- Verbesserungen für Media: Abhängig vom Dateityp wird jetzt die richtige ChatAction gesendet (upload_video, upload_audio, etc.)

- Dateien mit einer Größe von > 50 MB werden ignoriert
This commit is contained in:
Andreas Bielawski
2016-07-23 13:58:15 +02:00
parent e819ba4ded
commit a7e7629926
2 changed files with 35 additions and 12 deletions

View File

@@ -29,10 +29,19 @@ media.triggers = {
function media:action(msg)
local url = matches[1]
local ext = matches[2]
local receiver = msg.chat.id
local file, last_modified, nocache = get_cached_file(url, nil, msg.chat.id, 'upload_document', self)
local mime_type = mimetype.get_content_type_no_sub(ext)
local receiver = msg.chat.id
if mime_type == 'audio' then
chat_action = 'upload_audio'
elseif mime_type == 'video' then
chat_action = 'upload_video'
else
chat_action = 'upload_document'
end
local file, last_modified, nocache = get_cached_file(url, nil, msg.chat.id, chat_action, self)
if not file then return end
if ext == 'gif' then
print('send gif')