27 lines
695 B
Python
Executable File
27 lines
695 B
Python
Executable File
# coding=utf-8
|
|
"""
|
|
uptime.py - Uptime module
|
|
Copyright 2014, Fabian Neundorf
|
|
Licensed under the Eiffel Forum License 2.
|
|
|
|
http://sopel.chat
|
|
"""
|
|
import datetime
|
|
|
|
from module import commands
|
|
|
|
|
|
def setup(bot):
|
|
if "uptime" not in bot.memory:
|
|
bot.memory["uptime"] = datetime.datetime.utcnow()
|
|
|
|
|
|
@commands('uptime')
|
|
def uptime(bot, trigger):
|
|
""".uptime - Returns the uptime of Sopel."""
|
|
delta = datetime.timedelta(seconds=round((datetime.datetime.utcnow() -
|
|
bot.memory["uptime"])
|
|
.total_seconds()))
|
|
bot.say("I've been sitting here for {} and I keep "
|
|
"going!".format(delta))
|