summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
Diffstat (limited to 'Biz')
-rwxr-xr-x[-rw-r--r--]Biz/Bot.scm49
1 files changed, 28 insertions, 21 deletions
diff --git a/Biz/Bot.scm b/Biz/Bot.scm
index dec654c..c06c651 100644..100755
--- a/Biz/Bot.scm
+++ b/Biz/Bot.scm
@@ -1,14 +1,20 @@
+#!/usr/bin/env sh
+exec guile -l $BIZ_ROOT/Biz/Bot.scm -e '(@ (Biz Bot) main)' -s "$0" "$@"
+!#
+
+
;; Usage with ii:
;;
;; tail -f \#biz/out | guile -L $BIZ_ROOT -s Biz/Bot.scm
-(import (ice-9 rdelim))
-(import (ice-9 match))
-(import (ice-9 regex))
-(import (ice-9 receive))
-
-(import (bs core))
-(import (prefix (bs string) string.))
+(define-module (Biz Bot)
+ #:use-module (ice-9 rdelim)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 receive)
+ #:use-module (bs core)
+ #:use-module ((bs string) #:prefix string.)
+ #:export (main))
(define (log msg)
(display msg (current-error-port)))
@@ -39,17 +45,18 @@
(else
(display (fmt "command not understood: ~a" msg))))))
-(while #t
- (match (parse-line (read-line))
- [('user user msg)
- (if (is-command? msg)
- (dispatch user msg)
- (begin
- (log (fmt "user: ~a " user))
- (log (fmt "message: ~a" msg))))]
-
- [('system msg)
- (log (fmt "system: ~a" msg))])
-
- (newline)
- (force-output))
+(define (main args)
+ (while #t
+ (match (parse-line (read-line))
+ [('user user msg)
+ (if (is-command? msg)
+ (dispatch user msg)
+ (begin
+ (log (fmt "user: ~a " user))
+ (log (fmt "message: ~a" msg))))]
+
+ [('system msg)
+ (log (fmt "system: ~a" msg))])
+
+ (newline)
+ (force-output)))