Roll your own IRC bot/Transcript

From HaskellWiki

A transcript of the final bot connecting to the server, and executing some commands.

From an IRC client[edit]

17:31 -- tutbot [n=tutbot@aa.bb.cc.dd] has joined #tutbot-testing
17:31  dons> !id hello, world!
17:31  tutbot> hello, world!
17:31  dons> !uptime
17:31  tutbot> 47s
17:31  dons> this isn't a command
17:31  dons> !uptime
17:31  tutbot> 54s
17:31  dons> !quit
17:31 -- tutbot [n=tutbot@aa.bb.cc.dd] has quit [Client Quit]

From standard output[edit]

$ runhaskell bot.hs
Connecting to irc.freenode.org ... done.
> NICK tutbot
> USER tutbot 0 * :tutorial bot
> JOIN #tutbot-testing
NOTICE AUTH :*** Looking up your hostname...
NOTICE AUTH :*** Checking ident
NOTICE AUTH :*** Found your hostname
NOTICE AUTH :*** No identd (auth) response
:sterling.freenode.net 001 tutbot :Welcome to the freenode IRC Network tutbot
:sterling.freenode.net 002 tutbot :Your host is sterling.freenode.net
NOTICE tutbot :*** Your host is sterling.freenode.net
:sterling.freenode.net 003 tutbot :This server was created Sat Dec 17 11:06:05 UTC 2005
:sterling.freenode.net 004 tutbot sterling.freenode.net hyperion-1.0.2 aAbBcCdDeEfFGhHiIjkKlLmMnNopPQrRsStTuUvVwWxXyYzZ01234569*@ bcdefFhiIklmnoPqstv
:sterling.freenode.net 005 tutbot IRCD=dancer CAPAB CHANTYPES=# EXCEPTS INVEX CHANMODES=bdeIq,k,lfJD,cgijLmnPQrRstz CHANLIMIT=#:20 PREFIX=(ov)@+ MAXLIST=bdeI:50 MODES=4 STATUSMSG=@ KNOCK NICKLEN=16 :are supported by this server
:sterling.freenode.net 005 tutbot SAFELIST CASEMAPPING=ascii CHANNELLEN=30 TOPICLEN=450 KICKLEN=450 KEYLEN=23 USERLEN=10 HOSTLEN=63 SILENCE=50 :are supported by this server
:sterling.freenode.net 251 tutbot :There are 13325 listed and 13588 unlisted users on 20 servers
:sterling.freenode.net 252 tutbot 32 :flagged staff members
:sterling.freenode.net 254 tutbot 13001 :channels formed
:sterling.freenode.net 255 tutbot :I have 3411 clients and 0 servers
:sterling.freenode.net 265 tutbot :Current local  users: 3411  Max: 7994
:sterling.freenode.net 266 tutbot :Current global users: 26913  Max: 31917
:sterling.freenode.net 250 tutbot :Highest connection count: 7996 (7994 clients) (548945 since server was (re)started)
:sterling.freenode.net 375 tutbot :- sterling.freenode.net Message of the Day - 
:sterling.freenode.net 372 tutbot :- Welcome to sterling.freenode.net in Hoofddorp, NL, EU! 
:sterling.freenode.net 372 tutbot :- Thanks to Chris Mentjox, Martijn Bakker, Guido Bakker, Peter
:sterling.freenode.net 372 tutbot :- Bosgraaf and to Cable & Wireless for sponsoring this server!
:sterling.freenode.net 372 tutbot :- 
:sterling.freenode.net 372 tutbot :- STERLING, BRUCE, [1954-].  Born in Texas, US, author of
:sterling.freenode.net 372 tutbot :- Islands in the Net, The Hacker Crackdown and numerous
:sterling.freenode.net 372 tutbot :- other titles, Bruce Sterling is an unofficial spokesman for
:sterling.freenode.net 372 tutbot :- the cyberpunk genre of science fiction.  He writes a regular
:sterling.freenode.net 372 tutbot :- column, Catscan, for SF Eye and lives in Austin, Texas,
:sterling.freenode.net 372 tutbot :- with his wife and daughter.
:sterling.freenode.net 372 tutbot :- 
:sterling.freenode.net 372 tutbot :- You're using freenode, a service of Peer-Directed Projects
:sterling.freenode.net 372 tutbot :- Center (http://freenode.net/pdpc.shtml).
:sterling.freenode.net 372 tutbot :- 
:sterling.freenode.net 372 tutbot :- Freenode runs an open proxy scanner. Your use of the network
:sterling.freenode.net 372 tutbot :- indicates your acceptance of this policy. For details on
:sterling.freenode.net 372 tutbot :- freenode network policy, please take a look at our policy
:sterling.freenode.net 372 tutbot :- page (http://freenode.net/policy.shtml). Thank you for using
:sterling.freenode.net 372 tutbot :- the network!
:sterling.freenode.net 372 tutbot :- 
:sterling.freenode.net 372 tutbot :- Freenode is a service of Peer-Directed Projects Center, an
:sterling.freenode.net 372 tutbot :- IRS 501(c)(3) not-for-profit organization.  Our yearly
:sterling.freenode.net 372 tutbot :- fundraiser will begin soon; if you'd like to donate early,
:sterling.freenode.net 372 tutbot :- please see http://freenode.net/pdpc_donations.shtml for more
:sterling.freenode.net 372 tutbot :- information.  Thank you for using freenode!
:sterling.freenode.net 372 tutbot :- 
:sterling.freenode.net 376 tutbot :End of /MOTD command.
:tutbot!n=tutbot@aa.bb.cc.dd JOIN :#tutbot-testing
:sterling.freenode.net 353 tutbot @ #tutbot-testing :tutbot dons 
:sterling.freenode.net 366 tutbot #tutbot-testing :End of /NAMES list.
:freenode-connect!freenode@freenode/bot/connect PRIVMSG tutbot :VERSION
:dons!i=dons@my.net PRIVMSG #tutbot-testing :!id hello, world!
> PRIVMSG #tutbot-testing :hello, world!
:dons!i=dons@my.net PRIVMSG #tutbot-testing :!uptime
> PRIVMSG #tutbot-testing :47s
:dons!i=dons@my.net PRIVMSG #tutbot-testing :this isn't a command
:dons!i=dons@my.net PRIVMSG #tutbot-testing :!uptime
> PRIVMSG #tutbot-testing :54s
:dons!i=dons@my.net PRIVMSG #tutbot-testing :!quit
> QUIT :Exiting