Rename time to ts

This commit is contained in:
Mark Veidemanis 2022-07-21 13:39:54 +01:00
parent 4734a271a1
commit 2177766d90
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 9 additions and 9 deletions

View File

@ -221,8 +221,8 @@ class IRCBot(IRCClient):
del main.TempChan[self.net]
def event(self, **cast):
if not "time" in cast.keys():
cast["time"] = str(datetime.now().isoformat())
if not "ts" in cast.keys():
cast["ts"] = str(datetime.now().isoformat())
# remove odd stuff
for i in list(cast.keys()): # Make a copy of the .keys() as Python 3 cannot handle iterating over
@ -699,7 +699,7 @@ class IRCBot(IRCClient):
"net": self.net,
"num": self.num,
"status": "signedon",
"time": ctime,
"ts": ctime,
}
)
if not self.authenticated:
@ -747,7 +747,7 @@ class IRCBot(IRCClient):
self.event(type="kick", muser=kicker, channel=channel, msg=message, user=kickee)
def chanlessEvent(self, cast):
cast["time"] = str(datetime.now().isoformat())
cast["ts"] = str(datetime.now().isoformat())
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
# function is converted to the new net, num
@ -834,7 +834,7 @@ class IRCBotFactory(ReconnectingClientFactory):
"num": self.num,
"status": "lost",
"message": error,
"time": ctime,
"ts": ctime,
}
)
self.retry(connector)
@ -857,7 +857,7 @@ class IRCBotFactory(ReconnectingClientFactory):
"num": self.num,
"status": "failed",
"message": error,
"time": ctime,
"ts": ctime,
}
)
self.retry(connector)

View File

@ -24,7 +24,7 @@ order = [
"realname",
"server",
"status",
"time",
"ts",
]

View File

@ -8,8 +8,8 @@ from utils.logging.debug import debug
def dedup(numName, b):
c = deepcopy(b)
if "time" in c.keys():
del c["time"]
if "ts" in c.keys():
del c["ts"]
c["approxtime"] = str(datetime.utcnow().timestamp())[: main.config["Tweaks"]["DedupPrecision"]]
castHash = siphash24(main.hashKey, dumps(c, sort_keys=True).encode("utf-8"))
del c["approxtime"]