diff --git a/images/into_the_trash.png b/images/into_the_trash.png new file mode 100644 index 0000000..dd28031 Binary files /dev/null and b/images/into_the_trash.png differ diff --git a/internet.lua b/internet.lua index 7d8769f..a26945e 100644 --- a/internet.lua +++ b/internet.lua @@ -88,8 +88,9 @@ end -------------------------------------------------------------------------------- -- Search wikipedia for images on pages ---[[ local WIKIPEDIA_API_URL = 'https://%s.wikipedia.org/w/api.php?action=query&titles=%s&prop=pageimages&format=json&piprop=original&redirects=1&prop=categories&prop=links' + +--[[ local WIKIPEDIA_DISAMBIGUATION_CATEGORIES_FOR_LANG = { da = 'Kategori:Flertydig', en = 'Category:All disambiguation pages' diff --git a/memes.lua b/memes.lua index 3da744a..d00c652 100644 --- a/memes.lua +++ b/memes.lua @@ -382,6 +382,12 @@ local generate_skorsten_image = generate_comparison_meme_generator { { x = 646, xr = 0, y = 366, yr = 0, w = 631, h = 215, font_color = COLOR_WHITE }, } +local generate_into_the_trash = generate_comparison_meme_generator { + base_img_path = './images/into_the_trash.png', + + { x = 377, xr = 20, y = 261, yr = 20, w = 400, h = 400, font_color = COLOR_BLACK }, +} + local GENERATE_COMPARISON_MEME_OF_2 = { generate_distracted_boyfriend, generate_distracted_boyfriend_oldy_times, @@ -518,6 +524,24 @@ function memes.generate_for_message (user, message) end end + -- Into the trash + do + -- Attempt to match + local problem_text + for _, pattern in ipairs { '^(.-)%s+er%s+skrald(.-)$', '^(.-)%s+is%s+trash(.-)$' } do + problem_text = message:lower():match(pattern) + if problem_text then break end + end + + -- Create image based on match + if problem_text then + print(problem_text) + local topic = fill_in_topics_information { problem_text } + local img_link = generate_into_the_trash(topic) + return img_link, 'TRASH' + end + end + -- Comparison memes local topics = get_topics_from_comparison_message(message) if not topics then return end