! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors calendar.format combinators.smart constructors io.encodings.utf8 io.sockets irc-client irc-client.messages kernel namespaces sequences ; QUALIFIED-WITH: multi-methods mm QUALIFIED-WITH: sequences s IN: irc-client.logbot TUPLE: log-bot < irc-client ; CONSTRUCTOR: log-bot ( duplex-stream -- obj ) ; ! Log pings for some reason mm:METHOD: handle-message { ping { current-irc-client log-bot } } [ timestamp>> timestamp>rfc822 "Ping received at " prepend global. ] [ trailing>> /PONG ] bi ; mm:METHOD: handle-message { privmsg { current-irc-client log-bot } } [ [ target>> ] [ sender>> ] [ text>> ] tri ] output>array " " s:join global. ; : startbot ( -- ) "irc.freenode.net" 6667 utf8 drop current-irc-client [ "NICK fbot122erg" print-irc "USER fbot122erg fbot irc.freenode.net :lol" print-irc irc-loop ] with-variable ;