This commit is contained in:
Frisk 2020-03-16 00:12:00 +01:00
parent 3ce102ba2d
commit 62f14cb5de
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -1065,8 +1065,19 @@ def day_overview():
changed_bytes = 0 changed_bytes = 0
new_articles = 0 new_articles = 0
active_articles = [] active_articles = []
if not result[0] and not settings["send_empty_overview"]: if not result[0]:
if not settings["send_empty_overview"]:
return # no changes in this day return # no changes in this day
else:
embed = defaultdict(dict)
embed["title"] = _("Daily overview")
embed["url"] = create_article_path("Special:Statistics")
embed["description"] = _("No activity")
embed["color"] = settings["appearance"]["embed"]["daily_overview"]["color"]
embed["author"]["icon_url"] = settings["appearance"]["embed"]["daily_overview"]["icon"]
embed["author"]["name"] = settings["wikiname"]
embed["author"]["url"] = create_article_path("")
else:
for item in result[0]: for item in result[0]:
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
@ -1122,7 +1133,7 @@ def day_overview():
(ngettext("Most active hour", "Most active hours", len(active_hours)), ', '.join(active_hours) + houramount), (ngettext("Most active hour", "Most active hours", len(active_hours)), ', '.join(active_hours) + houramount),
(_("Day score"), overall)) (_("Day score"), overall))
for name, value in fields: for name, value in fields:
embed["fields"].append({"name": name, "value": value}) embed["fields"].append({"name": name, "value": value, "inline": True})
data = {"embeds": [dict(embed)]} data = {"embeds": [dict(embed)]}
formatted_embed = json.dumps(data, indent=4) formatted_embed = json.dumps(data, indent=4)
send_to_discord(formatted_embed) send_to_discord(formatted_embed)