old_contents: from twisted.internet import reactor, protocol
  from twisted.words.protocols import irc
  
  
  class LoggingIRCClient(irc.IRCClient):
  
      nickname = 'batuli'
  
      def signedOn(self):
          self.join('##testbot')
  
      def joined(self, channel):
          if channel == '##testbot':
              self.msg("batul", "givemelogs")
  
      def privmsg(self, user, channel, msg):
          user = user.split('!')[0]
          if (user == "batul"):
              print(msg)
  
  
  def main():
      f = protocol.ReconnectingClientFactory()
      f.protocol = LoggingIRCClient
      reactor.connectTCP('irc.freenode.net', 6667, f)
      reactor.run()
  
  if __name__ == '__main__':
      main()
  
new_contents: from twisted.internet import reactor, protocol
  from twisted.words.protocols import irc
  
  
  class LoggingIRCClient(irc.IRCClient):
  
      nickname = raw_input("Enter a nickname: ")
  
      def signedOn(self):
          self.join('##testbot')
  
      def privmsg(self, user, channel, msg):
          if msg == '~pym':
              self.msg(channel, 'http://pymbook.readthedocs.org/en/latest/')
  
  
  def main():
      f = protocol.ReconnectingClientFactory()
      f.protocol = LoggingIRCClient
      reactor.connectTCP('irc.freenode.net', 6667, f)
      reactor.run()
  
  if __name__ == '__main__':
      main()
  
subject: add ~pym feature to post pymbook link