aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/ping.py
blob: 637f71e81d785be93b02758f9a24751676acc389 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"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))