21 lines
481 B
Python
21 lines
481 B
Python
|
#!/usr/bin/env python3
|
||
|
"""
|
||
|
How long the bot has been running.
|
||
|
"""
|
||
|
import datetime
|
||
|
|
||
|
from module import commands
|
||
|
|
||
|
|
||
|
def setup(bot):
|
||
|
if "uptime" not in bot.memory:
|
||
|
bot.memory["uptime"] = datetime.datetime.now()
|
||
|
|
||
|
|
||
|
@commands('uptime')
|
||
|
def uptime(bot, trigger):
|
||
|
""".uptime - Returns the uptime of Sopel."""
|
||
|
delta = datetime.timedelta(seconds=round((datetime.datetime.now() -
|
||
|
bot.memory["uptime"]).total_seconds()))
|
||
|
bot.say(f"I've been sitting here for {delta} and I keep going!")
|