aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/ping.py
diff options
context:
space:
mode:
authorGravatar Rohan Reddy Alleti <[email protected]>2021-04-15 19:07:15 +0530
committerGravatar GitHub <[email protected]>2021-04-15 19:07:15 +0530
commit01c61ec41acf38384450b25875d05e5ff1c50f5d (patch)
tree95ca1401bd5579ee964cc079e27e34748bde9d52 /bot/exts/evergreen/ping.py
parentMerge branch 'master' into reddit_migration (diff)
parentMerge pull request #679 from python-discord/vcokltfre/fix/timed-error-help (diff)
Merge branch 'main' into reddit_migration
Diffstat (limited to 'bot/exts/evergreen/ping.py')
-rw-r--r--bot/exts/evergreen/ping.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/bot/exts/evergreen/ping.py b/bot/exts/evergreen/ping.py
new file mode 100644
index 00000000..97f8b34d
--- /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=":ping_pong: Pong!",
+ colour=Colours.bright_green,
+ description=f"Gateway 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))