misc(speedtest): doing some testing
This commit is contained in:
parent
d557928fee
commit
cba25d1f94
2 changed files with 13 additions and 9 deletions
|
@ -34,6 +34,16 @@ class Bandwidth(BaseModel):
|
|||
elapsed: int
|
||||
latency: "Latency"
|
||||
|
||||
@property
|
||||
def mbps(self) -> float:
|
||||
return self.bandwidth / 1_000_000
|
||||
|
||||
class Latency(BaseModel):
|
||||
iqm: float
|
||||
low: float
|
||||
high: float
|
||||
jitter: float
|
||||
|
||||
class Interface(BaseModel):
|
||||
internalIp: str
|
||||
name: str
|
||||
|
@ -47,12 +57,6 @@ class Ping(BaseModel):
|
|||
low: float
|
||||
high: float
|
||||
|
||||
class Latency(BaseModel):
|
||||
iqm: float
|
||||
low: float
|
||||
high: float
|
||||
jitter: float
|
||||
|
||||
class Server(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
|
|
|
@ -62,16 +62,16 @@ class Speedtest(commands.Cog):
|
|||
await msg.edit(embed=discord.Embed(description=f"An error occurred! {speedtest}", color=discord.Colour.red()))
|
||||
return
|
||||
embed = discord.Embed(title="Speedtest Results", url=speedtest.result.url, color=await ctx.embed_color())
|
||||
embed.add_field(name="Bandwidth", value=f"{speedtest.download.bandwidth / 1_000_000:.2f} Mbps down, {speedtest.download.bandwidth / 1_000_000:.2f} Mbps up")
|
||||
embed.add_field(name="Bandwidth", value=f"{speedtest.download.mbps:,.2f} Mbps down, {speedtest.upload.mbps:,.2f} Mbps up")
|
||||
embed.add_field(name="Ping", value=f"Base: {round(speedtest.ping.latency)} ms \nDownload: {round(speedtest.download.latency.iqm)} ms \nUpload: {round(speedtest.upload.latency.iqm)} ms")
|
||||
embed.set_image(url=speedtest.result.image)
|
||||
await msg.edit(embed=embed)
|
||||
else:
|
||||
if not isinstance(speedtest, sp):
|
||||
await msg.edit(content=f"An error occurred! {speedtest}")
|
||||
await msg.edit(content=f"An error occurred! \n`{speedtest}`")
|
||||
return
|
||||
await msg.edit(content=f"**Speedtest Results**\n"
|
||||
f"**Bandwidth**: {speedtest.download.bandwidth / 1_000_000:.2f} Mbps down, {speedtest.download.bandwidth / 1_000_000:.2f} Mbps up\n"
|
||||
f"**Bandwidth**: {speedtest.download.mbps:,.2f} Mbps down, {speedtest.download.mbps:,.2f} Mbps up\n"
|
||||
f"**Ping**: Base: {round(speedtest.ping.latency)} ms\n"
|
||||
f"Download: {round(speedtest.download.latency.iqm)} ms\n"
|
||||
f"Upload: {round(speedtest.upload.latency.iqm)} ms\n"
|
||||
|
|
Loading…
Reference in a new issue