def on_pubmsg(self, c, e): """Hook for public not-prefixed written text inside a channel. -> e.target() == channel -> e.source() == nick!~user@hostname """ nick, hostname = nm_to_n(e.source()), nm_to_h(e.source()) if not nick in self.users: self.users[nick] = User(nick, hostname, self.connection) user, chan = self.users[nick], self.chans[e.target().lower()] line_raw = e.arguments()[0] data = Data(line_raw=line_raw, chan=chan, user=user) # execute plugins if line_raw.startswith(self.command_prefix): data.line_raw = data.line_raw[len(self.command_prefix):] data.reaction_type = "public_command" self.dispatch(data) else: data.reaction_type = "public" self.dispatch(data)
def on_pubmsg(self, c, e): """Hook for public not-prefixed written text inside a channel. -> e.target() == channel -> e.source() == nick!~user@hostname """ nick, hostname = nm_to_n(e.source()), nm_to_h(e.source()) if not nick in self.users: self.users[nick] = User(nick, hostname, self.connection) user, chan = self.users[nick], self.chans[e.target().lower()] line_raw = e.arguments()[0] data = Data(line_raw=line_raw, chan=chan, user=user) # execute plugins if line_raw.startswith(self.command_prefix): data.line_raw = data.line_raw[len(self.command_prefix):] data.reaction_type = "public_command" self.dispatch(data) else: data.reaction_type = "public" self.dispatch(data)