Paste: ircbot

Author: piranha
Mode: factor
Date: Mon, 6 Oct 2008 19:28:56
Plain Text |
USING: kernel irc.client concurrency.mailboxes namespaces ;

IN: ircbot

SYMBOL: bot
SYMBOL: chan

: botsetup
    "irc.freenode.org" irc-port "prhbot" f <irc-profile> <irc-client> bot set
    "#prhchan" <irc-channel-listener> chan set ;

: botgo ( -- )
    bot get [ ] [ botsetup ] if
    bot get connect-irc
    chan get bot get add-listener ;

: wr ( message -- ) chan get write-message ;

: cr ( -- message ) chan get in-messages>> dup
    mailbox-empty?
    [ "empty" ]
    [ mailbox-get ]
    if ;

New Annotation

Summary:
Author:
Mode:
Body: