feat(commands|Network>ping): feat ping command
This commit is contained in:
parent
0c308727d2
commit
434021ecb9
2 changed files with 23 additions and 0 deletions
|
@ -61,6 +61,8 @@ Windows
|
|||
|
||||
*not for now and not for the future*
|
||||
|
||||
--------------
|
||||
|
||||
Configure PostgreSQL
|
||||
--------------------
|
||||
|
||||
|
@ -76,6 +78,8 @@ https://wiki.archlinux.org/index.php/PostgreSQL
|
|||
|
||||
Continue to `create the venv <#creating-the-virtual-environment>`__.
|
||||
|
||||
--------------
|
||||
|
||||
Debian
|
||||
^^^^^^
|
||||
|
||||
|
@ -83,6 +87,8 @@ https://wiki.debian.org/PostgreSql
|
|||
|
||||
Continue to `create the venv <#creating-the-virtual-environment>`__.
|
||||
|
||||
--------------
|
||||
|
||||
RHEL and derivatives (CentOS, Fedora...)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -90,6 +96,8 @@ https://fedoraproject.org/wiki/PostgreSQL
|
|||
|
||||
Continue to `create the venv <#creating-the-virtual-environment>`__.
|
||||
|
||||
--------------
|
||||
|
||||
Creating the Virtual Environment
|
||||
--------------------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import functools
|
||||
import logging
|
||||
import time
|
||||
from typing import Union
|
||||
|
||||
import aiohttp
|
||||
|
@ -214,3 +215,17 @@ class Network(commands.Cog, name="Network"):
|
|||
)
|
||||
|
||||
await ctx.send(embed=e)
|
||||
|
||||
@command_extra(name="ping", deletable=True)
|
||||
async def _ping(self, ctx: ContextPlus):
|
||||
start = time.perf_counter()
|
||||
await ctx.trigger_typing()
|
||||
end = time.perf_counter()
|
||||
|
||||
latency = round(self.bot.latency * 1000, 2)
|
||||
typing = round((end - start) * 1000, 2)
|
||||
|
||||
e = discord.Embed(title="Ping", color=discord.Color.teal())
|
||||
e.add_field(name="Websocket", value=f"{latency}ms")
|
||||
e.add_field(name="Typing", value=f"{typing}ms")
|
||||
await ctx.send(embed=e)
|
||||
|
|
Loading…
Reference in a new issue