1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-03 00:23:13 +00:00
Lumi/modules/misc/ping.py
2024-07-17 08:01:12 -04:00

32 lines
1,000 B
Python

from datetime import datetime
from discord.ext import bridge
from lib.constants import CONST
from lib.embed_builder import EmbedBuilder
async def ping(self, ctx: bridge.BridgeContext) -> None:
embed = EmbedBuilder.create_success_embed(
ctx,
author_text=CONST.STRINGS["ping_author"],
description=CONST.STRINGS["ping_pong"],
footer_text=CONST.STRINGS["ping_footer"].format(
round(1000 * self.client.latency),
),
)
await ctx.respond(embed=embed)
async def uptime(self, ctx: bridge.BridgeContext, start_time: datetime) -> None:
unix_timestamp: int = int(round(self.start_time.timestamp()))
embed = EmbedBuilder.create_success_embed(
ctx,
author_text=CONST.STRINGS["ping_author"],
description=CONST.STRINGS["ping_uptime"].format(unix_timestamp),
footer_text=CONST.STRINGS["ping_footer"].format(
round(1000 * self.client.latency),
),
)
await ctx.respond(embed=embed)