From 3f99fe15eb87c43de9c7df6514413d67099658f0 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 13 Apr 2020 17:16:46 -0500 Subject: better giphy link matching --- posterbot.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'posterbot.lisp') diff --git a/posterbot.lisp b/posterbot.lisp index c354154..0af7d07 100644 --- a/posterbot.lisp +++ b/posterbot.lisp @@ -69,7 +69,7 @@ :case-insensitive-mode t)) (defparameter +giphy-link-regex+ - (ppcre:create-scanner "https://giphy.com/gifs/.+-([a-zA-Z0-9]+)" + (ppcre:create-scanner "https://giphy.com/gifs/([a-z0-9]+-)*([a-zA-Z0-9]+)" :case-insensitive-mode t)) (defun download-link (link) @@ -108,7 +108,7 @@ the downloaded file. If there is an error thrown at any point, returns NIL." (ppcre:scan-to-strings +giphy-link-regex+ word) (declare (ignore string)) (when (plusp (length matches)) - (format nil "https://media.giphy.com/media/~a/giphy.gif" (elt matches 0))))) + (format nil "https://media.giphy.com/media/~a/giphy.gif" (elt matches 1))))) (t nil))) (defun handle-link-candiate (word) -- cgit v1.2.3