chatikbot.lisp 804 B

123456789101112131415161718192021
  1. (in-package #:chatikbot)
  2. ;; Load config file
  3. (alexandria:when-let (file (probe-file
  4. (merge-pathnames "config.lisp"
  5. (asdf:component-pathname
  6. (asdf:find-system '#:chatikbot)))))
  7. (load file))
  8. (defparameter +akb-user-id+ "3021296351" "Twitter user id of 'B-category anecdotes'")
  9. (defvar *akb-max-count* 5 "Max number of tweets to return per run")
  10. (defvar *akb-last-id* nil "id of last AKB tweet")
  11. (defun fetch-latest-akb ()
  12. (loop for (id . text) in (get-tweets +akb-user-id+
  13. :since-id *akb-last-id*
  14. :count *akb-max-count*)
  15. do (setf *akb-last-id* (max (or *akb-last-id* 0) id))
  16. collect text))