ping: always show round-trip time instead of only when >500ms
Lint / Shell (shellcheck) (push) Successful in 9s
Lint / JS (eslint) (push) Successful in 8s
Lint / Python (ruff) (push) Failing after 6s
Lint / Python deps (pip-audit) (push) Successful in 1m39s
Lint / Secret scan (gitleaks) (push) Successful in 9s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 00:39:10 -04:00
parent 973e422678
commit e4dbcfde7a
+2 -4
View File
@@ -137,11 +137,9 @@ async def cmd_help(client: AsyncClient, room_id: str, sender: str, args: str):
@command("ping", "Check bot latency")
async def cmd_ping(client: AsyncClient, room_id: str, sender: str, args: str):
start = time.monotonic()
_ = await send_text(client, room_id, "Pong!")
await send_text(client, room_id, "Pong!")
elapsed = (time.monotonic() - start) * 1000
# Edit isn't straightforward in Matrix, so just send a follow-up if slow
if elapsed > 500:
await send_text(client, room_id, f"(round-trip: {elapsed:.0f}ms)")
await send_text(client, room_id, f"round-trip: {elapsed:.0f}ms")