-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathping.py
30 lines (21 loc) · 818 Bytes
/
ping.py
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
29
30
from discord import Embed
from discord.ext import commands
from pydis_core.utils.logging import get_logger
from bot.bot import SirRobin
log = get_logger(__name__)
class Ping(commands.Cog):
"""Send an embed about the bot's ping."""
def __init__(self, bot: SirRobin):
self.bot = bot
@commands.command(name="ping")
async def ping(self, ctx: commands.Context) -> None:
"""Ping the bot to see its latency and state."""
log.debug(f"Command `{ctx.invoked_with}` used by {ctx.author}.")
embed = Embed(
title=":ping_pong: Pong!",
description=f"Gateway Latency: {round(self.bot.latency * 1000)}ms",
)
await ctx.send(embed=embed)
async def setup(bot: SirRobin) -> None:
"""Load the Ping cog."""
await bot.add_cog(Ping(bot))