aboutsummaryrefslogtreecommitdiff
path: root/modules/stats.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-08-18 21:54:12 +0100
committerGravatar jesopo2018-08-18 21:54:12 +0100
commit88eb7b695ffd5bba6e22b228900e570aecf1eb6f (patch)
treefd15ae45b70bfb8fd48231451919291d59bc9f7d /modules/stats.py
parentcheck if a table exists before making it instead of catching the sqlite (diff)
signature
show uptime in 1w1d1h1m1s format
Diffstat (limited to 'modules/stats.py')
-rw-r--r--modules/stats.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/modules/stats.py b/modules/stats.py
index 2f0953b5..09468327 100644
--- a/modules/stats.py
+++ b/modules/stats.py
@@ -1,4 +1,5 @@
import time
+import Utils
class Module(object):
def __init__(self, bot):
@@ -11,24 +12,8 @@ class Module(object):
def uptime(self, event):
seconds = int(time.time()-self.boot_time)
- minutes = int(seconds/60)
- if not minutes:
- event["stdout"].write("Uptime: %s seconds" % seconds)
- return
- hours, minutes = int(minutes/60), int(minutes%60)
- days, hours = int(hours/24), int(hours%24)
-
- days_str = ""
- hours_str = "00"
- minutes_str = "00"
- if days:
- days_str = "days "
- if hours:
- hours_str = str(hours).zfill(2)
- if minutes:
- minutes_str = str(minutes).zfill(2)
- event["stdout"].write("Uptime: %s%s:%s" % (days_str, hours_str,
- minutes_str))
+ event["stdout"].write("Uptime: %s" % Utils.to_pretty_time(
+ seconds))
def stats(self, event):
networks = len(self.bot.servers)