import time class Event: def __init__(self, time_start, time_stop, chance, command): self.time_start = time_start self.time_stop = time_stop self.chance = chance self.command = command self.executed = 0 def __str__(self): return str("Event starting at timestamp {}".format(self.time_start)) def loop(self, bot): if time.time() - bot.timestamp >= self.time_start: if time.time() - bot.timestamp < self.time_stop: self.execute() elif (self.time_stop == 0 or self.time_stop == self.time_start) and self.executed == 0: self.execute() def execute(self, bot): if self.command.startswith('printtime'): print(time.time()) self.executed += 1