import ircbot import time # Connection information network = 'irc.moparisthebest.com' port = 6667 channel = '#bottest' nick = 'Kolli|Bot' name = 'Kollidierende' # Open a file to store the logs in # We will append data to this file ( "a" ) logFile = open ( 'channelLog.txt', 'a' ) # Subclass Sim # Create our bot class class ExampleBot ( ircbot.SingleServerIRCBot ): # When welcomed, join the channel and perform the actions mentioned def on_welcome ( self, connection, event ): connection.join ( channel ) def on_pubmsg ( self, connection, event ): if event.arguments() [ 0 ].upper() == '!CHANINFO': source = event.source().split ( '!' ) [ 0 ] channelObject = self.channels [ channel ] # Message some statistics connection.privmsg ( source, 'Moderated: ' + str ( channelObject.is_moderated() ) ) connection.privmsg ( source, 'Number of users: ' + str ( len ( channelObject.users() ) ) ) connection.privmsg ( source, 'Channel operators: ' + str ( len (channelObject.opers() ) ) ) # Create our bot bot = ExampleBot ( [( network, port )], nick, name ) bot.start()