Add pingtime

This commit is contained in:
aikaterna
2018-05-03 17:21:47 -07:00
committed by GitHub
parent 1cf0398d05
commit b903b30dd9

17
pingtime/pingtime.py Normal file
View File

@@ -0,0 +1,17 @@
from discord.ext import commands
import time
class Pingtime:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def pingtime(self, ctx):
"""Ping pong."""
channel = ctx.message.channel
t1 = time.perf_counter()
await channel.trigger_typing()
t2 = time.perf_counter()
await ctx.send("Pong: {}ms".format(round((t2-t1)*1000)))