Paste: butt-head
Author: | erg |
Mode: | factor |
Date: | Sun, 5 Oct 2008 21:41:32 |
Plain Text |
USING: accessors assocs continuations debugger destructors
fry irc.bot irc.client irc.client.private irc.messages kernel
memoize namespaces random sequences sequences.lib soundex
make splitting threads ;
IN: irc.bot.butt-head
: butt-head-profile ( -- obj )
"irc.freenode.org" 6667 "butt-head" f <irc-profile> ;
: channels ( -- seq ) { "#concatenative" "#forth" } ;
MEMO: funny-words ( -- hash )
{
"anus" "ball" "balls" "bone" "boob" "boobs" "butt"
"cleave" "foreskin" "head" "hole" "monad"
"log" "logged" "penis" "score" "spread"
"wood" "poker"
}
[ [ soundex ] keep ] H{ } map>assoc ;
: sender ( privmsg -- string ) prefix>> "!" split1 drop ;
: line>soundex ( string -- seq )
"!@#$%^&*()+=-_[]{}|\\/?<>,.:;\"'~`\n\r " split
[ soundex ] map ;
: assoc-find-all ( seq assoc -- seq' )
[ at ] curry map sift ;
: funny-response ( seq -- )
first
"uh huh-huh-huh, huh-huh-huh, you said '"
swap "'" 3append bot-write ;
GENERIC: butt-head ( message -- ? )
M: privmsg butt-head ( privmsg -- ? )
[ trailing>> ] [ sender ] bi
2dup [ "quit" = ] [ "erg" = ] bi* and [
2drop f
] [
drop line>soundex funny-words assoc-find-all
[ ] [ funny-response ] if-empty t
] if ;
M: object butt-head ( obj -- ? )
drop t ;
: butt-head-loop ( -- )
[
current-listener get read-message
butt-head [ butt-head-loop ] when
] [ error. ] recover ;
: bot-the-channel ( string -- )
[
dup
'[
_
<irc-channel-listener>
[ irc> add-listener ]
[ current-listener [ butt-head-loop ] with-variable ] bi
]
swap "-butt-head-bot" append spawn drop
] with-scope ;
: do-it ( -- )
butt-head-profile <irc-client>
dup connect-irc current-irc-client set
channels [ bot-the-channel ] each ;
Author: | erg |
Mode: | factor |
Date: | Sun, 5 Oct 2008 21:45:55 |
Plain Text |
USING: accessors combinators irc.client kernel math
namespaces quotations sequences strings vectors ;
IN: irc.bot
TUPLE: bot { servers vector } ;
TUPLE: server
{ host string }
{ port integer }
{ nick string }
{ password string }
{ channels vector }
{ nickserv string initial: "nickserv" }
{ chanserv string initial: "chanserv" }
{ trusted vector } ;
TUPLE: channel
{ name string }
{ password string }
{ handler quotation initial: [ drop ] } ;
SYMBOL: current-listener
: bot-write ( string -- )
current-listener get write-message ;
: bot-server ( server -- )
{ [ host>> ] [ port>> ] [ nick>> ] [ password>> ] } cleave
<irc-profile> ;
: start-bot ( bot -- )
servers>> [ bot-server ] each ;
Author: | KurmanAhlabm |
Mode: | factor |
Date: | Sat, 15 Nov 2008 03:04:47 |
Plain Text |
Hi there!
My first post at this great blog!
I wanna show u my dayly updated blog: <a href= http://www.megautbe.cn >Black Amateur Fuck Video</a>
Have a nice day!
BB!
P.S. if you don't want to see this message please write me to no.ads08@gmail.com with subject "NO ADS" and URL of your forum
Thank you for cooperation!
New Annotation