remove lgreets/rgreets, add greets name specifying
parent
8f0c0d2083
commit
af4763ca21
24
anna.scm
24
anna.scm
|
@ -267,6 +267,14 @@
|
|||
(data (string-tokenize inl))
|
||||
(chn (scar (scdr (member "PRIVMSG" data))))
|
||||
(filtered-data (map input-filter data)))
|
||||
(define (get-greets left-or-right)
|
||||
(if (= 4 (length data))
|
||||
(number->string (all-greets left-or-right))
|
||||
(greets left-or-right (slist-ref data 4))))
|
||||
(define (left-greets)
|
||||
(get-greets *left-greets*))
|
||||
(define (right-greets)
|
||||
(get-greets *right-greets*))
|
||||
;; debug print
|
||||
(format #t "~s~%" data)
|
||||
(let ((command (slist-ref data 3)))
|
||||
|
@ -275,7 +283,7 @@
|
|||
(pong stream))
|
||||
((or (equal? ":!rollcall" command)
|
||||
(equal? ":!anna" command))
|
||||
(send-message stream chn "Hello! I respond to !anna, !tz <optionally user>, !greets, !lgreets <optionally user>, !rgreets <optionally user>, !dw <optionally \"eff\"> and !eval <s-expr>. My source code is available at https://git.tilde.town/opfez/anna"))
|
||||
(send-message stream chn "Hello! I respond to !anna, !tz <optionally user>, !greets <optionally user>, !dw <optionally \"eff\"> and !eval <s-expr>. My source code is available at https://git.tilde.town/opfez/anna"))
|
||||
((equal? ":!eval" command)
|
||||
(let ((expr (string-concatenate (intersperse " " (cdr (member ":!eval" filtered-data))))))
|
||||
(send-message stream chn (evaluate expr))))
|
||||
|
@ -287,21 +295,11 @@
|
|||
(send-message stream chn (if (= 4 (length data))
|
||||
(timezone (get-username (car data)))
|
||||
(timezone (slist-ref data 4)))))
|
||||
((equal? ":!lgreets" command)
|
||||
(format #t "~s~%" *left-greets*)
|
||||
(send-message stream chn (if (= 4 (length data))
|
||||
(greets *left-greets* (get-username (car data)))
|
||||
(greets *left-greets* (slist-ref data 4)))))
|
||||
((equal? ":!rgreets" command)
|
||||
(format #t "~s~%" *right-greets*)
|
||||
(send-message stream chn (if (= 4 (length data))
|
||||
(greets *right-greets* (get-username (car data)))
|
||||
(greets *right-greets* (slist-ref data 4)))))
|
||||
((equal? ":!greets" command)
|
||||
(send-message stream chn (string-append "o/ - "
|
||||
(number->string (all-greets *right-greets*))
|
||||
(right-greets)
|
||||
" vs \\o - "
|
||||
(number->string (all-greets *left-greets*)))))
|
||||
(left-greets))))
|
||||
((string-contains (empty-list->string (concat-messages data 3 (length data))) "\\o/")
|
||||
#f)
|
||||
((string-contains (empty-list->string (concat-messages data 3 (length data))) "\\o")
|
||||
|
|
Loading…
Reference in New Issue