From 840f9e925f9914cd6541344032ecce7e5eb82f9b Mon Sep 17 00:00:00 2001 From: iou1name Date: Thu, 21 Mar 2019 07:55:05 -0400 Subject: [PATCH] added .upwolf --- modules/uptime.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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)