Ejemplo n.º 1
0
 def __init__(self, fname):
     Persist.__init__(self, fname)
     if type(self.data) == list:
         tmp = {}
         for i in range(self.data):
             tmp[i] = self.data[i]
         self.data = tmp                
     for i in self.data:
         z = Alarmitem(d=self.data[i])
         periodical.addjob(z.time - time.time(), 1, self.alarmsay, z.nick, z)
Ejemplo n.º 2
0
 def add(self, botname, nick, ttime, txt, printto=None):
     """ add alarm """
     nick = nick.lower()
     nrid = nextid.next('alarms')
     item = Alarmitem(botname, nrid, nick, ttime, txt, printto=printto)
     pid = periodical.addjob(ttime - time.time(), 1, self.alarmsay, nick, item)
     item.idnr = pid
     self.data[nrid] = item
     self.save()
     return pid