This commit is contained in:
Frisk 2023-10-17 19:28:44 +02:00
parent be726cc955
commit f34643f77c

View file

@ -147,7 +147,7 @@ def day_overview(client):
if "actionhidden" in item or "suppressed" in item or "userhidden" in item: if "actionhidden" in item or "suppressed" in item or "userhidden" in item:
continue # while such actions have type value (edit/new/log) many other values are hidden and therefore can crash with key error, let's not process such events continue # while such actions have type value (edit/new/log) many other values are hidden and therefore can crash with key error, let's not process such events
activity = add_to_dict(activity, item["user"]) activity = add_to_dict(activity, item["user"])
hours = add_to_dict(hours, datetime.datetime.strptime(item["timestamp"], "%Y-%m-%dT%H:%M:%SZ").hour) hours = add_to_dict(hours, datetime.datetime.strptime(item["timestamp"], "%Y-%m-%dT%H:%M:%SZ").replace(minute=0, second=0, tzinfo=datetime.timezone.utc))
if item["type"] == "edit": if item["type"] == "edit":
edits += 1 edits += 1
changed_bytes += item["newlen"] - item["oldlen"] changed_bytes += item["newlen"] - item["oldlen"]
@ -171,8 +171,8 @@ def day_overview(client):
v = hours.values() v = hours.values()
active_hours = [] active_hours = []
for hour, numberh in Counter(hours).most_common(list(v).count(max(v))): # find most active hours for hour, numberh in Counter(hours).most_common(list(v).count(max(v))): # find most active hours
active_hours.append(str(hour)) active_hours.append("<t:"+str(int(hour.timestamp()))+":t>")
houramount = ngettext(" UTC ({} action)", " UTC ({} actions)", numberh).format(numberh) houramount = ngettext(" ({} action)", " ({} actions)", numberh).format(numberh)
else: else:
active_users = active_hours = [_("But nobody came")] # a reference to my favorite game of all the time, sorry ^_^ active_users = active_hours = [_("But nobody came")] # a reference to my favorite game of all the time, sorry ^_^
usramount = houramount = "" usramount = houramount = ""