def check(self, source, nickname): if not nickname in self.config: self.client.reply(source, 'I have never seen %s' % nickname) if isinstance(self.config[nickname], dict): self.client.reply( source, '%s was last seen %s in %s' % (nickname, timesince( datetime.datetime.utcfromtimestamp( self.config[nickname]['time'])), self.config[nickname]['channel'])) else: self.client.reply( source, '%s was last seen %s' % (nickname, timesince( datetime.datetime.utcfromtimestamp( self.config[nickname]))))
def check(self, source, nickname): if not nickname in self.config: self.client.reply(source, "I have never seen %s" % nickname) if isinstance(self.config[nickname], dict): self.client.reply( source, "%s was last seen %s in %s" % ( nickname, timesince(datetime.datetime.utcfromtimestamp(self.config[nickname]["time"])), self.config[nickname]["channel"], ), ) else: self.client.reply( source, "%s was last seen %s" % (nickname, timesince(datetime.datetime.utcfromtimestamp(self.config[nickname]))), )
def checkReminder(self, message): if not message.prefix['nickname'] in self.config: return nickname = message.prefix['nickname'] for reminder in self.config[nickname]: # Fallback for old reminders if not 'time' in reminder: date = datetime.datetime.utcnow() else: date = datetime.datetime.utcfromtimestamp(reminder['time']) self.client.reply( message, '%s, %s wants me to remind you %s (written %s)' % (nickname, reminder['from'], reminder['message'], timesince(date))) del self.config[nickname] self.config.save()
def checkReminder(self, message): if not message.prefix['nickname'] in self.config: return nickname = message.prefix['nickname'] for reminder in self.config[nickname]: # Fallback for old reminders if not 'time' in reminder: date = datetime.datetime.utcnow() else: date = datetime.datetime.utcfromtimestamp(reminder['time']) self.client.reply( message, '%s, %s wants me to remind you %s (written %s)' % ( nickname, reminder['from'], reminder['message'], timesince(date) ) ) del self.config[nickname] self.config.save()
def checkReminder(self, message): if not message.prefix['nickname'] in self.config: return nickname = message.prefix['nickname'] unsent = [] for reminder in self.config[nickname]: # Fallbacks for old reminders if not 'channel' in reminder: channel = None else: channel = reminder['channel'] if not 'time' in reminder: date = datetime.datetime.utcnow() else: date = datetime.datetime.utcfromtimestamp(reminder['time']) if channel != None and channel != message.target.lower(): unsent.append(reminder) continue self.client.reply( message, '%s, %s wants me to remind you %s (written %s)' % ( nickname, reminder['from'], reminder['message'], timesince(date) ) ) if len(unsent) > 0: self.config[nickname] = unsent else: del self.config[nickname] self.config.save()
def getUptime(self, source): process = psutil.Process(os.getpid()) self.client.reply(source, 'Uptime: %s' % timesince(datetime.datetime.utcfromtimestamp(process.create_time()), ''))