def list(self): index = 0 nrListed = 0 if (self.messagesCount > self.lastMessageListed) and (self.lastMessageListed > 0): self.lastMessageListed += 1 # Messages are already stored in ascending order for index in range(self.lastMessageListed, self.messagesCount): msg = self.messages[index] msgOwner = msg["user"] msgCreator = msgOwner["username"] msgDateUTC = msg["created_at"] timedate = local_datetime(msgDateUTC) time = timedate[1] print("Message " + msg["id"] + ", created by '" + msgCreator + "' on " + timedate[0] + " at " + time.lower() + " " + timedate[2]) print(" Text:" + msg["text"]) print() nrListed += 1 if (index > self.lastMessageListed): self.lastMessageListed = index if (nrListed > 0): print("Total messages listed: " + str(nrListed)) print() return None
def _parse_time(time): time = time.lower() if not time.isdigit(): time = re.split(r"\s*([\d.]+\s*[^\d\s,;]*)(?:[,;\s]|and)*", time) time = sum(map(_timespec_sec, filter(None, time))) return int(time)