From af4545b583de2b660ebff87fd2fc21158c57eda6 Mon Sep 17 00:00:00 2001 From: hkc Date: Fri, 15 Nov 2024 11:32:30 +0300 Subject: [PATCH] Less verbose /check command --- nfuck/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nfuck/__init__.py b/nfuck/__init__.py index d2a6ee1..fec0c47 100644 --- a/nfuck/__init__.py +++ b/nfuck/__init__.py @@ -41,9 +41,12 @@ async def on_check(message: Message): data = (await client.get(entity.url)).text total_score = 0 results.append(f"{sanitize_link(entity.url)}") - for score, explanation, match in explain_verification(data): - results.append(f"{match.span()}: {explanation}") + counts = {} + for score, explanation, _ in explain_verification(data): + counts[explanation] = counts.get(explanation, 0) + 1 total_score += score + for explanation, count in counts.items(): + results.append(f"{explanation}: x{count}") results.append(f"Total score: {total_score}") results.append("") if results: