USING: accessors fry io io.encodings.8-bit io.files irc.client irc.client.chats irc.messages.base kernel threads ; IN: irc.logbot : bot-profile ( -- obj ) "irc.freenode.org" 6667 "flogger" f ; : bot-channel ( -- seq ) "#concatenative" ; : log-stream ( -- stream ) "/tmp/concatenative.log" latin1 ; GENERIC: handle-message ( msg -- ) M: object handle-message drop ; M: irc-message handle-message line>> print flush ; : (bot-loop) ( chat -- ) dup hear handle-message (bot-loop) ; : bot-loop ( chat -- ) log-stream [ (bot-loop) ] with-output-stream ; : start-bot ( -- ) bot-profile [ connect-irc ] [ [ bot-channel ] dip '[ _ [ _ attach-chat ] [ bot-loop ] bi ] "LogBot" spawn drop ] bi ; : logbot ( -- ) start-bot ; MAIN: logbot