diff --git a/miku/plugins/id.lua b/miku/plugins/id.lua index 8a6262c..2186a06 100644 --- a/miku/plugins/id.lua +++ b/miku/plugins/id.lua @@ -28,9 +28,9 @@ function id:user_print_name(user) -- Yes, copied from stats plugin local text = '' if user.first_name then - text = user.last_name..' ' + text = user.first_name..' ' end - if user.lastname then + if user.last_name then text = text..user.last_name end diff --git a/miku/plugins/post_photo.lua b/miku/plugins/post_photo.lua index 90c9623..ca442fd 100644 --- a/miku/plugins/post_photo.lua +++ b/miku/plugins/post_photo.lua @@ -17,7 +17,7 @@ function post_photo:pre_process(msg, config) local file_size = msg.document.file_size if file_size > 19922944 then print('File is over 20 MB - can\'t download :(') - return + return msg end utilities.send_typing(msg.chat.id, 'upload_photo') diff --git a/miku/utilities.lua b/miku/utilities.lua index ed99a7c..5898648 100644 --- a/miku/utilities.lua +++ b/miku/utilities.lua @@ -948,22 +948,28 @@ function get_cached_file(url, file_name, receiver, chat_action) local header, code = get_http_header(url) -- file size limit is 50 MB - if header["Content-Length"] then - if tonumber(header["Content-Length"]) > 52420000 then - print('file is too large, won\'t send!') - return nil + if header then + + if header["Content-Length"] then + if tonumber(header["Content-Length"]) > 52420000 then + print('file is too large, won\'t send!') + return nil + end + elseif header["content-length"] then + if tonumber(header["content-length"]) > 52420000 then + print('file is too large, won\'t send!') + return nil + end end - elseif header["content-length"] then - if tonumber(header["content-length"]) > 52420000 then - print('file is too large, won\'t send!') - return nil - end - end - if header["last-modified"] then - last_modified = header["last-modified"] - elseif header["Last-Modified"] then - last_modified = header["Last-Modified"] + if header["last-modified"] then + last_modified = header["last-modified"] + elseif header["Last-Modified"] then + last_modified = header["Last-Modified"] + end + + else + last_modified = nil end if not last_modified then