Example #1
0
 def running_for(self):
     """
     Returns, how long the last plugin load is ago (normally this equals 
     the P1tr uptime.
     """
     delta = datetime.datetime.now() - self.launched_at
     return _('I am up and running for %s.' % time_ago_in_words(delta))
Example #2
0
 def running_for(self):
     """
     Returns, how long the last plugin load is ago (normally this equals 
     the P1tr uptime.
     """
     delta = datetime.datetime.now() - self.launched_at
     return _('I am up and running for %s.' % time_ago_in_words(delta))
Example #3
0
def last_seen(name):
    try:
        user = User.users[name]
        delta = SeenPlugin.now() - user.last_action.time
        return _("%s was last seen: %s ago, %s" % \
                 (user.name, time_ago_in_words(delta), user.last_action))
        #return user.last_action.time
    except KeyError:
        return _("Gee... I've never seen " + name)
        log('i', "Information about unknown User requested")
        raise
    except NameError:
        log('i', "User has no action defined yet")
        raise
Example #4
0
def last_seen(name):
    try:
        user = User.users[name]
        delta = SeenPlugin.now() - user.last_action.time
        return _("%s was last seen: %s ago, %s" % \
                 (user.name, time_ago_in_words(delta), user.last_action))
        #return user.last_action.time
    except KeyError:
        return _("Gee... I've never seen " + name)
        log('i', "Information about unknown User requested")
        raise
    except NameError:
        log('i', "User has no action defined yet")
        raise
Example #5
0
 def _print_memos_if_exist(self, user, chan, bot):
     """
     Takes IRCBot instance and user name (string), and writes all available
     notes for the user to the channel, if they exist.
     """
     luser = user.lower()
     if luser in self.mailbag.keys():
         for memo in self.mailbag[luser]:
             delta = datetime.datetime.now() - memo[1]
             bot.msg(chan, _('%s: %s left a memo for you %s ago: %s' %
                     (user, memo[0], time_ago_in_words(delta), memo[2])))
             # Delete the memo after showing it.
             index = self.mailbag[luser].index(memo)
             del self.mailbag[luser][index]
         # When no memos left, delete entire entry for user
         if not self.mailbag[luser]:
             del self.mailbag[luser]
         self.mailbag.sync()
Example #6
0
 def _print_memos_if_exist(self, user, chan, bot):
     """
     Takes IRCBot instance and user name (string), and writes all available
     notes for the user to the channel, if they exist.
     """
     luser = user.lower()
     if luser in self.mailbag.keys():
         for memo in self.mailbag[luser]:
             delta = datetime.datetime.now() - memo[1]
             bot.msg(
                 chan,
                 _('%s: %s left a memo for you %s ago: %s' %
                   (user, memo[0], time_ago_in_words(delta), memo[2])))
             # Delete the memo after showing it.
             index = self.mailbag[luser].index(memo)
             del self.mailbag[luser][index]
         # When no memos left, delete entire entry for user
         if not self.mailbag[luser]:
             del self.mailbag[luser]
         self.mailbag.sync()