[Twisted-Python] A Twisted Web Question....

JD lists at webcrunchers.com
Wed Dec 31 04:43:52 EST 2003

Below is a piece of code from  ircLogBot.py  in the examples section of 
Twisted release.

It makes reference to a "channel" - What is a channel.
I assume that "sys.argv[1]" when passed into main()
must be a "channel"

Of course the person who wrote this module just had no inclination to
actually tell anyone how to use it.    I know the 2nd argument is a file
name or path,  but what is a "channel"....

I know I probably am really lame for asking these kinds of
questions,  but i left my crystal ball on the planet venus,  and
can't read the mind of the person who wrote this module.

class LogBotFactory(protocol.ClientFactory):
     """A factory for LogBots.

     A new protocol instance will be created each time we connect to the 

     # the class of the protocol to build
     protocol = LogBot

     def __init__(self, channel, filename):
         self.channel = channel
         self.filename = filename

     def clientConnectionLost(self, connector, reason):
         """If we get disconnected, reconnect to server."""

     def clientConnectionFailed(self, connector, reason):
         print "connection failed:", reason

if __name__ == '__main__':
     # create factory protocol and application
     import sys
     f = LogBotFactory(sys.argv[1], sys.argv[2])

     # connect factory to this host and port
     reactor.connectTCP("irc.freenode.net", 6667, f)

     # run bot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1576 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031231/3509e2c5/attachment.bin 

More information about the Twisted-Python mailing list