IRC Socket example

Chris Double chris at
Thu Jul 23 06:46:46 UTC 2009

I'm playing around with Sockets in Self and put together a little IRC
bot object. It's pretty basic but is usable to talk to an IRC server.
The code is here:

Copy it to 'objects/applications' and load with:

 bootstrap read: 'ircBot' from: 'applications'.

It creates an 'ircBot' object in globals. You can copy this to connect
a server. There are slots for the server name, port and nickname.
These default to 'irc.freenode,net', 6667, and 'selfbot' respectively.

For testing I make a copy of this, and keep the outliner on the
screen. I create an evaluator for that object so I can send messages
to it. To use, first send 'connect'. This will connect to the server.
>From there you can use 'join: #channel' to join a channel and 'say:
msg To: channel' to talk in the channel. The server messages are
stored in a 'lines' slot as a list.

It was my first time building objects using the Self UI and finding
methods in existing objects using the search features. I was dubious
as to how productive it would be but it worked well.


More information about the Self-interest mailing list