blob: 71152d151c8acf2395a164ed82605e0994b74260 (
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
28
|
from discord import Embed
from discord.ext import commands
from bot.bot import Bot
from bot.constants import Colours
class Ping(commands.Cog):
"""Ping the bot to see its latency and state."""
def __init__(self, bot: 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: Bot) -> None:
"""Load the Ping cog."""
bot.add_cog(Ping(bot))
|