diff --git a/modules/uptime.py b/modules/uptime.py index 6d6ce0f..24c453c 100755 --- a/modules/uptime.py +++ b/modules/uptime.py @@ -37,6 +37,20 @@ def updick(bot, trigger): bot.msg("8" + "="*delta.days + "D") +@commands('upwulf') +def updick(bot, trigger): + """.upwulf - Returns the uptime of Fulvia, measured in Adalwulfs.""" + if trigger.group(2): + if trigger.group(2) in bot.users: + d = defer.Deferred() + d.addCallback(idleTimeWulf, bot) + bot.memory["idle_callbacks"][trigger.group(2)] = d + bot.whois(trigger.group(2)) + else: + delta = datetime.datetime.now() - bot.memory["uptime"] + bot.msg("Adalwulf" + "_"*delta.days) + + def idleTime(result, bot): """ result - tuple containing (nick, idle, signon) @@ -45,3 +59,13 @@ def idleTime(result, bot): t = datetime.datetime.fromtimestamp(int(signon)) delta = datetime.datetime.now() - t bot.msg("8" + "="*delta.days + "D") + + +def idleTimeWulf(result, bot): + """ + result - tuple containing (nick, idle, signon) + """ + nick, idle, signon = result + t = datetime.datetime.fromtimestamp(int(signon)) + delta = datetime.datetime.now() - t + bot.msg("Adalwulf" + "_"*delta.days)