added .upwolf

This commit is contained in:
iou1name 2019-03-21 07:55:05 -04:00
parent 041a95f3af
commit 840f9e925f

View File

@ -37,6 +37,20 @@ def updick(bot, trigger):
bot.msg("8" + "="*delta.days + "D") 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): def idleTime(result, bot):
""" """
result - tuple containing (nick, idle, signon) result - tuple containing (nick, idle, signon)
@ -45,3 +59,13 @@ def idleTime(result, bot):
t = datetime.datetime.fromtimestamp(int(signon)) t = datetime.datetime.fromtimestamp(int(signon))
delta = datetime.datetime.now() - t delta = datetime.datetime.now() - t
bot.msg("8" + "="*delta.days + "D") 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)