blob: 97f8b34d5c91feca0c259e1905abace818f68403 (
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"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))
 |