From 022a90254ff34a994b2e046cbfe63716b5ba1bd5 Mon Sep 17 00:00:00 2001 From: opfez Date: Thu, 8 Apr 2021 14:46:41 +0000 Subject: [PATCH] fix eval, prepare for multiple channels --- anna.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/anna.scm b/anna.scm index 5c35f74..bac523f 100644 --- a/anna.scm +++ b/anna.scm @@ -6,6 +6,7 @@ (ice-9 format)) (define +channel+ "#bots") +(define +channels+ '("#tildetown" "#bots")) (define (scdr lst) "Safe CDR which will return the empty list if it is passed the empty list instead of throwing an error." @@ -56,8 +57,11 @@ (define (send-user stream) (format stream "USER anna 0.0.0.0 anna :Anna\r\n")) -(define (join-channel stream) - (format stream "JOIN ~a\r\n" +channel+)) +(define (join-channels stream) + ;; (for-each (lambda (chn) + ;; (format stream "JOIN ~a\r\n" chn)) + ;; +channels+)) + (format stream "JOIN ~a\r\n" "#bots")) (define (send-message stream chn msg) (format stream "PRIVMSG ~a :~a\r\n" chn msg)) @@ -77,7 +81,7 @@ (equal? ":!anna" (slist-ref data 3))) (send-message stream +channel+ "Hello! I respond to !rollcall, !anna, and !eval .")) ((equal? ":!eval" (slist-ref data 3)) - (let* ((expr (string-concatenate (intersperse " " (cdr (member ":eval" data)))))) + (let* ((expr (string-concatenate (intersperse " " (cdr (member ":!eval" data)))))) (send-message stream +channel+ (eval (read (open-input-string expr)) (interaction-environment))))) ((and (= 7 (length data)) @@ -90,6 +94,6 @@ (let* ((io (make-connection "127.0.0.1" 6667))) (send-nick io) (send-user io) - (join-channel io) + (join-channels io) (main-loop io))