PREDICATE: string privmsg "PRIVMSG" swap subseq? ;
M: string handle-irc ( line -- )
- drop ( print flush ) ;
+ drop ;
: parse-privmsg ( line -- text )
":" ?head drop
: irc-loop ( -- )
irc-stream get stream-readln
- [ handle-irc irc-loop ] when* ;
+ [ dup print flush handle-irc irc-loop ] when* ;
: factorbot
"irc.freenode.net" connect
] [
nip [
dup word-string " -- " rot word-url append3 respond
- ] each-with
+ ] each
] ifte ;
: quit ( text -- )
- drop speaker "slava" = [ disconnect ] when ;
-
-factorbot
+ drop speaker get "slava" = [ disconnect ] when ;