Exemple #1
0
	def onCtcp(self, chan, who, cmd, arg):
		if cmd == "VERSION":
			self.notice(who.nick, "\x01VERSION Schongo Bot %s\x01" % version)
		elif cmd == "PING":
			self.notice(who.nick, "\x01PING %s\x01" % arg)
		else:
			modules.fire_hook("ctcp", modules.IrcContext(self, chan, who), cmd, arg)
Exemple #2
0
	def onMessage(self, msg):
		# Call the parent so we still function.
		IrcClient.onMessage(self, msg)
		# Fire off an event for modules to eat
		modules.fire_hook("irc_%s" % msg.command, 
				modules.IrcContext(self, None, msg.origin),
				msg)
Exemple #3
0
 def onNotice(self, target, who, message):
     if not self._ns_authed and who.nick == self._ns_name:
         if self._ns_find in message:
             self.say(self._ns_name, "IDENTIFY %s" % self._ns_pass)
     else:  # Intentionally don't allow it to intercept NickServ messages.
         modules.fire_hook("notice", modules.IrcContext(self, target, who),
                           message)
Exemple #4
0
 def onCtcp(self, chan, who, cmd, arg):
     if cmd == "VERSION":
         self.notice(who.nick, "\x01VERSION Schongo Bot %s\x01" % version)
     elif cmd == "PING":
         self.notice(who.nick, "\x01PING %s\x01" % arg)
     else:
         modules.fire_hook("ctcp", modules.IrcContext(self, chan, who), cmd,
                           arg)
Exemple #5
0
    def onConnected(self):
        IrcClient.onConnected(self)

        if self.user_modes is not None:
            self.sendMessage("MODE", self.nick, self.user_modes)

        modules.fire_hook("connected", self)
        for i in self.channels:
            self.join_channel(i)
Exemple #6
0
	def onConnected(self):
		IrcClient.onConnected(self)

		if self.user_modes is not None:
			self.sendMessage("MODE", self.nick, self.user_modes)

		modules.fire_hook("connected", self)
		for i in self.channels:
			self.join_channel(i)	
Exemple #7
0
    def onDisconnected(self):
        modules.fire_hook("disconnected", self)
        IrcClient.onDisconnected(self)
        global connections

        connections -= 1

        if connections == 0:
            self.logger.info("Shutting down.")
            modules.shutdown()
Exemple #8
0
	def onDisconnected(self):
		modules.fire_hook("disconnected", self)
		IrcClient.onDisconnected(self)
		global connections

		connections -= 1

		if connections == 0:
			self.logger.info("Shutting down.")
			modules.shutdown()
Exemple #9
0
    def lineReceived(self, line):
        prefix = ""
        line_split = line.split(" ")
        if line_split[0].startswith(":"):
            line_split[0] = line_split[0][1:]
            prefix = line_split[0]
            line_split = line_split[1:]

        command = line_split[0]
        params = line_split[1:]
        parsed_params = []
        index = 0
        for param in params:
            if param.startswith(':'):
                param = param[1:]
                params[index] = param
                parsed_params.append(' '.join(params[index:]))
                break
            else:
                parsed_params.append(param)
            index += 1

            logging.debug("Recieved command {0}".format(command))
            modules.fire_hook(command, self, prefix, parsed_params)
Exemple #10
0
	def onNick(self, old, new):
		modules.fire_hook("nick", modules.IrcContext(self, None, old), new)
Exemple #11
0
	def onTopic(self, who, chan, topic):
		modules.fire_hook("topic", modules.IrcContext(self,chan,who),topic)
Exemple #12
0
	def onQuit(self, who, message):
		modules.fire_hook("quit", modules.IrcContext(self, None, who))
Exemple #13
0
	def onPart(self, who, chan, msg):
		modules.fire_hook("part", modules.IrcContext(self, chan, who))
Exemple #14
0
	def onJoin(self, who, chan):
		modules.fire_hook("join", modules.IrcContext(self, chan, who))
Exemple #15
0
 def onNick(self, old, new):
     modules.fire_hook("nick", modules.IrcContext(self, None, old), new)
Exemple #16
0
 def onAction(self, chan, who, what):
     modules.fire_hook("action", modules.IrcContext(self, chan, who), what)
Exemple #17
0
 def onMsg(self, chan, who, what):
     modules.fire_hook("message", modules.IrcContext(self, chan, who), what)
Exemple #18
0
 def onPart(self, who, chan, msg):
     modules.fire_hook("part", modules.IrcContext(self, chan, who))
Exemple #19
0
 def onMessage(self, msg):
     # Call the parent so we still function.
     IrcClient.onMessage(self, msg)
     # Fire off an event for modules to eat
     modules.fire_hook("irc_%s" % msg.command,
                       modules.IrcContext(self, None, msg.origin), msg)
Exemple #20
0
 def onQuit(self, who, message):
     modules.fire_hook("quit", modules.IrcContext(self, None, who))
Exemple #21
0
 def onMode(self, who, chan, mode, args):
     modules.fire_hook("mode", modules.IrcContext(self, chan, who), mode,
                       args)
Exemple #22
0
	def onMode(self, who, chan, mode, args):
		modules.fire_hook("mode", modules.IrcContext(self, chan, who), mode, args)
Exemple #23
0
	def onNotice(self, target, who, message):
		if not self._ns_authed and who.nick == self._ns_name:
			if self._ns_find in message:
				self.say(self._ns_name, "IDENTIFY %s" % self._ns_pass)
		else: # Intentionally don't allow it to intercept NickServ messages.
			modules.fire_hook("notice", modules.IrcContext(self, target, who), message);
Exemple #24
0
	def onAction(self, chan, who, what):
		modules.fire_hook("action", modules.IrcContext(self, chan, who), what)
Exemple #25
0
 def onJoin(self, who, chan):
     modules.fire_hook("join", modules.IrcContext(self, chan, who))
Exemple #26
0
 def onTopic(self, who, chan, topic):
     modules.fire_hook("topic", modules.IrcContext(self, chan, who), topic)
Exemple #27
0
	def onMsg(self, chan, who, what):
		modules.fire_hook("message", modules.IrcContext(self, chan, who), what)
Exemple #28
0
	def onConnected(self):

		IrcClient.onConnected(self)
		modules.fire_hook("connected", self)
		for i in self.channels:
			self.join_channel(i)