diff --git a/memes.lua b/memes.lua index e11ef02..e00e06e 100644 --- a/memes.lua +++ b/memes.lua @@ -562,31 +562,19 @@ function memes.generate_for_message (user, message) return 'https://www.youtube.com/watch?v=wl-LeTFM8zo', 'MACHINE' end - -- Is this a rich picture? - if is_image_link(message) then - local url = message - local img_link = generate_is_this_a_pidgeon { - { type = 'image', url = url }, - { type = 'text', text = 'Is this a rich picture?' } - } - return img_link, 'KYNG' - end - - - do -- Curb your enthusiasm local url = message:match '^[Cc]urb%s+[Yy]our%s+(.+)$' - if url then + if url then local url2, timestamp = message:match '^(..-)%s+at%s+(-?[%d.]+)$' if url2 then url = url2 end - timestamp = timestamp and tonumber(timestamp) or nil - assert(type(timestamp) == 'number' or timestamp == nil) - local video_filename = curb.your_video(url, timestamp) - assert(check_file_exists(video_filename)) - local video_url = save_file_to_dcav(video_filename) - os.remove(video_filename) - return video_url, 'CURB' - end + timestamp = timestamp and tonumber(timestamp) or nil + assert(type(timestamp) == 'number' or timestamp == nil) + local video_filename = curb.your_video(url, timestamp) + assert(check_file_exists(video_filename)) + local video_url = save_file_to_dcav(video_filename) + os.remove(video_filename) + return video_url, 'CURB' + end end -- Vælter min skorsten @@ -617,6 +605,16 @@ function memes.generate_for_message (user, message) end end + -- Is this a rich picture? + if is_image_link(message) then + local url = message + local img_link = generate_is_this_a_pidgeon { + { type = 'image', url = url }, + { type = 'text', text = 'Is this a rich picture?' } + } + return img_link, 'KYNG' + end + -- Comparison memes local topics = get_topics_from_comparison_message(message) if not topics then return end