def dispatch(self, callback, bot, ievent):

        """ dispatch callback on ircevent. """

        try:
            result = re.search(callback.compiled, ievent.txt.strip())
            if result:
                ievent.groups = list(result.groups())                
                if callback.threaded:
                    thr.start_bot_command(callback.func, (bot, ievent))
                else:
                    cmndrunners.put(callback.plugname, callback.func, bot, \
ievent)
                return 1
        except Exception, ex:
            handle_exception(ievent)
Exemple #2
0
    def dispatch(self, com, bot, ievent):
        """ dispatch on ircevent passing bot an ievent as arguments """

        if bot.stopped:
            return 0

        # stats
        stats.up('cmnds', com.name)
        stats.up('cmnds', com.plugname)
        stats.up('cmnds', 'speed%s' % com.speed)

        # execute command
        if com.threaded:
            start_bot_command(com.func, (bot, ievent))
        else:
            speed = ievent.speed or com.speed
            ievent.speed = speed
            cmndrunners[10 - speed].put(com.name, com.func, bot, ievent)
        return 1
Exemple #3
0
    def dispatch(self, com, bot, ievent):

        """ dispatch on ircevent passing bot an ievent as arguments """

        if bot.stopped:
            return 0

        # stats
        stats.up('cmnds', com.name)
        stats.up('cmnds', com.plugname)
        stats.up('cmnds', 'speed%s' % com.speed)

        # execute command
        if com.threaded:
            start_bot_command(com.func, (bot, ievent))
        else:	
            speed = ievent.speed or com.speed
            ievent.speed = speed
            cmndrunners[10-speed].put(com.name, com.func, bot, ievent)
        return 1