2024-08-28 10:29:16 +00:00
|
|
|
from discord.ext import commands
|
2024-08-29 08:48:14 +00:00
|
|
|
|
2024-09-02 08:16:43 +00:00
|
|
|
import lib.format
|
2024-09-03 07:47:46 +00:00
|
|
|
from lib.client import Luminara
|
2024-08-28 10:42:03 +00:00
|
|
|
from lib.const import CONST
|
2024-08-29 08:48:14 +00:00
|
|
|
from ui.embeds import Builder
|
2024-08-28 10:29:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Ping(commands.Cog):
|
2024-09-03 07:47:46 +00:00
|
|
|
def __init__(self, bot: Luminara):
|
2024-08-28 10:29:16 +00:00
|
|
|
self.bot = bot
|
2024-09-02 08:16:43 +00:00
|
|
|
self.ping.usage = lib.format.generate_usage(self.ping)
|
2024-08-28 10:29:16 +00:00
|
|
|
|
2024-09-01 12:11:54 +00:00
|
|
|
@commands.hybrid_command(name="ping")
|
2024-09-03 07:47:46 +00:00
|
|
|
async def ping(self, ctx: commands.Context[Luminara]) -> None:
|
2024-09-01 12:11:54 +00:00
|
|
|
"""
|
2024-09-02 20:31:25 +00:00
|
|
|
Show Luminara's latency.
|
2024-09-01 12:11:54 +00:00
|
|
|
|
|
|
|
Parameters
|
|
|
|
----------
|
2024-09-03 07:47:46 +00:00
|
|
|
ctx : commands.Context[Luminara]
|
2024-09-01 12:11:54 +00:00
|
|
|
The context of the command.
|
|
|
|
"""
|
2024-08-29 08:48:14 +00:00
|
|
|
embed = Builder.create_embed(
|
2024-09-03 10:16:21 +00:00
|
|
|
Builder.SUCCESS,
|
2024-08-28 13:53:21 +00:00
|
|
|
user_name=ctx.author.name,
|
2024-08-28 10:42:03 +00:00
|
|
|
author_text=CONST.STRINGS["ping_author"],
|
|
|
|
description=CONST.STRINGS["ping_pong"],
|
|
|
|
footer_text=CONST.STRINGS["ping_footer"].format(
|
|
|
|
round(1000 * self.bot.latency),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
await ctx.send(embed=embed)
|
2024-08-28 10:29:16 +00:00
|
|
|
|
|
|
|
|
2024-09-03 07:47:46 +00:00
|
|
|
async def setup(bot: Luminara) -> None:
|
2024-08-28 10:29:16 +00:00
|
|
|
await bot.add_cog(Ping(bot))
|