示例#1
0
文件: botbase.py 项目: code2u/jsb
 def dostart(self, botname=None, bottype=None, *args, **kwargs):
     """ create an START event and send it to callbacks. """
     e = EventBase()
     e.bot = self
     e.botname = botname or self.cfg.name
     e.bottype = bottype or self.type
     e.origin = e.botname
     e.ruserhost = self.cfg.name +'@' + self.uuid
     e.userhost = e.ruserhost
     e.channel = botname
     e.origtxt = "%s.%s - %s" % (e.botname, e.bottype, str(time.time()))
     e.txt = e.origtxt
     e.cbtype = 'START'
     e.botoutput = False
     e.ttl = 1
     e.nick = self.cfg.nick or self.cfg.name
     self.doevent(e)
     logging.debug("%s - START event send to callbacks" % self.cfg.name)
示例#2
0
 def dostart(self, botname=None, bottype=None, *args, **kwargs):
     """ create an START event and send it to callbacks. """
     e = EventBase()
     e.bot = self
     e.botname = botname or self.name
     e.bottype = bottype or self.type
     e.origin = botname
     e.ruserhost = self.botname + '@' + self.uuid
     e.userhost = e.ruserhost
     e.channel = botname
     e.origtxt = str(time.time())
     e.txt = e.origtxt
     e.cbtype = 'START'
     e.botoutput = False
     e.ttl = 1
     e.nick = self.nick or self.botname
     self.doevent(e)
     logging.debug("%s - START event send to callbacks" % botname)
示例#3
0
 def outmonitor(self, origin, channel, txt, event=None):
     """ create an OUTPUT event with provided txt and send it to callbacks. """
     if event: e = cpy(event)
     else: e = EventBase()
     if e.status == "done":
         logging.debug("%s - outmonitor - event is done .. ignoring" % self.name)
         return
     e.bot = self
     e.origin = origin
     e.ruserhost = self.botname +'@' + self.uuid
     e.userhost = e.ruserhost
     e.auth = e.userhost
     e.channel = channel
     e.origtxt = txt
     e.txt = txt
     e.cbtype = 'OUTPUT'
     e.botoutput = True
     e.nodispatch = True
     e.ttl = 1
     e.nick = self.nick or self.botname
     e.bind(self)
     first_callbacks.check(self, e)
示例#4
0
 def outmonitor(self, origin, channel, txt, event=None):
     """ create an OUTPUT event with provided txt and send it to callbacks. """
     if event: e = cpy(event)
     else: e = EventBase()
     if e.status == "done":
         logging.debug("%s - outmonitor - event is done .. ignoring" %
                       self.name)
         return
     e.bot = self
     e.origin = origin
     e.ruserhost = self.botname + '@' + self.uuid
     e.userhost = e.ruserhost
     e.auth = e.userhost
     e.channel = channel
     e.origtxt = txt
     e.txt = txt
     e.cbtype = 'OUTPUT'
     e.botoutput = True
     e.nodispatch = True
     e.ttl = 1
     e.nick = self.nick or self.botname
     e.bind(self)
     first_callbacks.check(self, e)