Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show final rtt result in bold #242

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions jishaku/features/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,18 @@ async def jsk_rtt(self, ctx: ContextA):

# We do 6 iterations here.
# This gives us 5 visible readings, because a request can't include the stats for itself.
for _ in range(6):
for i in range(6):
# First generate the text
text = "Calculating round-trip time...\n\n"
text += "\n".join(f"Reading {index + 1}: {reading * 1000:.2f}ms" for index, reading in enumerate(api_readings))

if api_readings:
average, stddev = mean_stddev(api_readings)

text += f"\n\nAverage: {average * 1000:.2f} \N{PLUS-MINUS SIGN} {stddev * 1000:.2f}ms"
average_str = f"\n\nAverage: {average * 1000:.2f} \N{PLUS-MINUS SIGN} {stddev * 1000:.2f}ms"
if i < 5:
text += average_str
else:
text += f"**{average_str}**"
else:
text += "\n\nNo readings yet."

Expand Down