Example #1
0
    def __init__(self, *args, **kwargs):
        """Initializes the IrcBot. The following arguments are required:
            * host - the server you want to connect to
            * port - the port on the server you want to connect to
            * nick - the nickname to use of the bot
            * identity - the identity of the bot
            * real_name - the 'real name' of the bot
            * owner - name of the owner (usually your name)
        """
        self.host = kwargs.get('host')
        self.port = kwargs.get('port', 6667)
        self.channels = kwargs.get('channels')
        self.nick = kwargs.get('nick')
        self.identity = kwargs.get('identity')
        self.real_name = kwargs.get('real_name')
        self.owner = kwargs.get('owner')

        self.socket = MySocket(self.host, self.port)
        self._actions = []
        self.add_action(PingAction(self))
        self.add_action(self.HELP_ACTION(self))
        for action in self.DEFAULT_ACTIONS:
            self.add_action(action(self))
        self._reading_thread = ReadingThread(self)
        self._reading_thread.start()
        self.connect()