Esempio n. 1
0
 def handle(self, job):
     """ schedule a bot command. """
     bot, event = job.args
     logging.warn("got speech from %s" % event.display())
     self.starttime = time.time()
     if not ievent.nolog: logging.debug("long event handler is %s" % str(func))
     func = job.func
     res = callbacks.check(bot, ievent)
     self.elapsed = time.time() - self.starttime
     if self.elapsed < 1 and self.nowrunning not in self.shortrunning: self.shortrunning.append(self.nowrunning)
     return res
Esempio n. 2
0
 def handle(self):
     """ send TICK events to callback. """
     self.counter += 1
     event = EventBase()
     event.nolog = True
     event.nobind = True
     if self.counter % 60 == 0:
         event.type = event.cbtype = 'TICK60'
         callbacks.check(self.bot, event)
     if self.counter % 10 == 0:
         event.type = event.cbtype = 'TICK10'
         callbacks.check(self.bot, event)
     maincfg = getmainconfig()
     t = maincfg.ticksleep or 1
     if self.counter % t == 0:
         event.type = event.cbtype = 'TICK'
         callbacks.check(self.bot, event)