From 9b24998c17fc0539da378b48dba8ae2741f7a1b1 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Wed, 10 Oct 2018 18:46:34 -0500 Subject: [PATCH] Add a ping command --- cogs/misc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cogs/misc.py b/cogs/misc.py index 3a9c5dd..efc1ef8 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -108,6 +108,15 @@ class Miscallaneous: if ctx.guild: await ctx.send("I have just DM'd you some information about me!") + @commands.command() + @utils.can_run(send_messages=True) + async def ping(self, ctx): + """Returns the latency between the server websocket, and between reading messages""" + msg_latency = datetime.datetime.utcnow() - ctx.message.created_at + fmt = "Message latency {0:.2f} seconds".format(msg_latency.seconds + msg_latency.microseconds / 1000000) + fmt += "\nWebsocket latency {0:.2f} seconds".format(self.bot.latency) + await ctx.send(fmt) + @commands.command(aliases=["coin"]) @utils.can_run(send_messages=True) async def coinflip(self, ctx):