From 7d9cf84c7de1845bfdb5203ed8cf62b33b76cc3a Mon Sep 17 00:00:00 2001 From: vcokltfre Date: Tue, 13 Apr 2021 15:45:07 +0100 Subject: feat: add ping command --- bot/exts/evergreen/ping.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 bot/exts/evergreen/ping.py diff --git a/bot/exts/evergreen/ping.py b/bot/exts/evergreen/ping.py new file mode 100644 index 00000000..022d6373 --- /dev/null +++ b/bot/exts/evergreen/ping.py @@ -0,0 +1,27 @@ +from discord import Embed +from discord.ext import commands + +from bot.constants import Colours + + +class Ping(commands.Cog): + """Ping the bot to see its latency and state.""" + + def __init__(self, bot: commands.Bot): + self.bot = bot + + @commands.command(name="ping") + async def ping(self, ctx: commands.Context) -> None: + """Ping the bot to see its latency and state.""" + embed = Embed( + title="Pong!", + colour=Colours.bright_green, + description=f"WS Latency: {round(self.bot.latency * 1000)}ms", + ) + + await ctx.send(embed=embed) + + +def setup(bot: commands.Bot) -> None: + """Cog load.""" + bot.add_cog(Ping(bot)) -- cgit v1.2.3