Compare commits

...

3 Commits

2 changed files with 12 additions and 0 deletions

2
bot.py
View File

@ -446,6 +446,8 @@ class Fulvia(irc.IRCClient):
line = "-!- {oldname} is now known as {newname}"
for channel_name, channel in self.channels.items():
if oldname not in channel.users.keys():
continue
self.log(channel_name, line)
user = channel.users.pop(oldname)

View File

@ -7,6 +7,7 @@ import datetime
from twisted.internet import defer
from module import commands
import tools.time
def setup(bot):
@ -69,3 +70,12 @@ def idleTimeWulf(result, bot):
t = datetime.datetime.fromtimestamp(int(signon))
delta = datetime.datetime.now() - t
bot.msg("Adalwulf" + "_"*delta.days)
@commands('unix')
def unixtolocal(bot, trigger):
"""Converts the given timestamp from unix time to local time."""
unix = int(trigger.group(2))
dt = datetime.datetime.utcfromtimestamp(unix)
dt = dt.replace(tzinfo=datetime.timezone.utc)
bot.msg(dt.astimezone(tz=None).strftime('%Y-%m-%d %H:%M:%S'))