Exemple #1
0
    def on_channel_message( self, event ):
        message = event.message.split()
        command = message[0]
        params  = message[1:]
        self.currentNick = event.source

        if event.source not in self.tell:
            self.tell[event.source] = False

        if command[0] == "!": # only handle commands directed to us...
            if len( command ) == 1: # skip single !'s and stuff
                return

            command =  command[1:].lower()
            if command in self.commands: # ... that exist
                ( level, func ) = self.commands[ command ]

                for name in self.channelusers[ event.target ]:
                    if protocol.strip_name_symbol( name ) == event.source: break # name is now event.target's name

                ulevel = 0
                if name[0] in self.access: # do not handle 'empty' users
                    ulevel = self.access[ name[0] ]

                if  ulevel < self.access[ level ]:
                    self.send_message( event.target, format.color( "ERROR:", format.RED ) + " You are not allowed to use the " + format.bold( command ) + " Command" )
                    return
                func( self, command, params, event )
        elif self.tellre.match(event.message):
            nick = self.tellre.match(event.message).groups()[0]

            if nick in self.tell and self.tell[nick] != False: # known but nont online
                self.tell[nick].append((time.gmtime(), event.target, "{}: {}".format(event.source, format.color(event.message, format.GREEN))))
                self.send_message(event.target, "I'll pass that on to {}".format(nick))
Exemple #2
0
        def on_private_message( self, event ):
                message = event.message.split()
                command = message[0].upper()
                params  = message[1:]

                if command.lower() in self.commands:
                        ( level, func ) = self.commands[ command.lower() ]

                        for name in self.channelusers[next(iter(self.channels))]: # FIXME: random channel
                                if protocol.strip_name_symbol( name ) == event.source: break # name is now event.target's name

                        ulevel = 0
                        if name[0] in self.access: # do not handle 'empty' users
                                ulevel = self.access[ name[0] ]

                        if ulevel < self.access[ level ]:
                                self.send_message( event.source, format.color( "ERROR:", format.RED ) + " You are not allowed to use the " + format.bold( command ) + " Command" )
                                return
                        func( self, command, params, event, received="private" ) # tell the function this was a private message and call it
Exemple #3
0
        def on_channel_message( self, event ):
                message = event.message.split()
                command = message[0]
                params  = message[1:]

                if len( command ) == 1: # skip single !'s and stuff
                        return

                if command[0] == "!": # only handle commands directed to us...
                        command =  command[1:].lower()
                        if command in self.commands: # ... that exist
                                ( level, func ) = self.commands[ command ]

                                for name in self.channelusers[ event.target ]:
                                        if protocol.strip_name_symbol( name ) == event.source: break # name is now event.target's name

                                ulevel = 0
                                if name[0] in self.access: # do not handle 'empty' users
                                        ulevel = self.access[ name[0] ]

                                if  ulevel < self.access[ level ]:
                                        self.send_message( event.target, format.color( "ERROR:", format.RED ) + " You are not allowed to use the " + format.bold( command ) + " Command" )
                                        return
                                func( self, command, params, event )