Add Speedtest cog #28

Open
cswimr wants to merge 17 commits from speedtest into main
Showing only changes of commit 9103d64fbc - Show all commits

View file

@ -62,17 +62,10 @@ 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.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! \n`{speedtest}`")
return
await msg.edit(content=f"**Speedtest Results**\n"
f"**Bandwidth**: {speedtest.download.mbps:,.2f} Mbps down ({speedtest.download.bandwidth}), {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"
f"**Image**: {speedtest.result.image}")
await msg.edit(content=f"**[Result]({speedtest.result.url})**")