summaryrefslogtreecommitdiff
path: root/posterbot.lisp
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-04-13 17:16:46 -0500
committerColin Okay <cbeok@protonmail.com>2020-04-13 17:16:46 -0500
commit3f99fe15eb87c43de9c7df6514413d67099658f0 (patch)
tree6d4d858af4b93df714493c765beb1bb0f4ab5d44 /posterbot.lisp
parent321b078ca5be33d2add66611c73e57c2e9b98d8b (diff)
better giphy link matching
Diffstat (limited to 'posterbot.lisp')
-rw-r--r--posterbot.lisp4
1 files changed, 2 insertions, 2 deletions
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)