def __init__(self, ip, port, nickname): # vars Basic.__init__(self) self.nickname = nickname self.current_channel = None self.queue = [] self.loop_threads = [] # calls self.connect(ip, port) self.nick(nickname) self.user(nickname, nickname, nickname, nickname)
def topic(self, topic, channel=None): if not channel: channel = self.current_channel Basic.topic(self, channel, topic)
def privmsg(self, msg, reciever=None): if not reciever: reciever = self.current_channel Basic.privmsg(self, msg, reciever)
def join(self, channel): Basic.join(self, channel) self.current_channel = channel log.info('Joined {}'.format(channel))
def disconnect(self, quitmsg=None): irc.events.fire('disconnected', self) self.quit(quitmsg) # send queue (to prevent "EOF from client") self.send_queue() Basic.disconnect(self)
def send_queue(self): for line in self.queue: Basic.send(self, line) self.queue = []