1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 20:23:12 +00:00
Lumi/modules/misc/ping.py

39 lines
1 KiB
Python
Raw Normal View History

from discord.ext import commands
2024-08-29 08:48:14 +00:00
import lib.format
from lib.client import Luminara
from lib.const import CONST
2024-08-29 08:48:14 +00:00
from ui.embeds import Builder
class Ping(commands.Cog):
def __init__(self, bot: Luminara):
self.bot = bot
self.ping.usage = lib.format.generate_usage(self.ping)
2024-09-01 12:11:54 +00:00
@commands.hybrid_command(name="ping")
async def ping(self, ctx: commands.Context[Luminara]) -> None:
2024-09-01 12:11:54 +00:00
"""
Show Luminara's latency.
2024-09-01 12:11:54 +00:00
Parameters
----------
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(
Builder.SUCCESS,
user_name=ctx.author.name,
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)
async def setup(bot: Luminara) -> None:
await bot.add_cog(Ping(bot))