Remove boot_time from stats.py, move it to start_time in IRCBot otherwise a

module reload of stats.py would reset !uptime
This commit is contained in:
jesopo 2018-09-11 18:24:34 +01:00
parent 80ec110640
commit 614f63bda3
2 changed files with 2 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import ModuleManager, Timer
class Bot(object): class Bot(object):
def __init__(self): def __init__(self):
self.start_time = time.time()
self.lock = threading.Lock() self.lock = threading.Lock()
self.args = None self.args = None
self.database = None self.database = None

View file

@ -3,7 +3,6 @@ import Utils
class Module(object): class Module(object):
def __init__(self, bot, events, exports): def __init__(self, bot, events, exports):
self.boot_time = time.time()
self.bot = bot self.bot = bot
events.on("received").on("command").on("uptime" events.on("received").on("command").on("uptime"
).hook(self.uptime, help="Show my uptime") ).hook(self.uptime, help="Show my uptime")
@ -11,7 +10,7 @@ class Module(object):
).hook(self.stats, help="Show my network/channel/user stats") ).hook(self.stats, help="Show my network/channel/user stats")
def uptime(self, event): def uptime(self, event):
seconds = int(time.time()-self.boot_time) seconds = int(time.time()-self.bot.start_time)
event["stdout"].write("Uptime: %s" % Utils.to_pretty_time( event["stdout"].write("Uptime: %s" % Utils.to_pretty_time(
seconds)) seconds))