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

33 lines
1,000 B
Python
Raw Normal View History

2024-07-17 12:01:12 +00:00
from datetime import datetime
from discord.ext import bridge
2024-07-17 12:01:12 +00:00
from lib.constants import CONST
2024-07-17 12:01:12 +00:00
from lib.embed_builder import EmbedBuilder
2024-07-17 11:47:26 +00:00
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"],
2024-07-17 11:47:26 +00:00
footer_text=CONST.STRINGS["ping_footer"].format(
round(1000 * self.client.latency),
),
)
await ctx.respond(embed=embed)
2024-07-17 11:47:26 +00:00
async def uptime(self, ctx: bridge.BridgeContext, start_time: datetime) -> None:
unix_timestamp: int = int(round(self.start_time.timestamp()))
2024-07-17 11:47:26 +00:00
embed = EmbedBuilder.create_success_embed(
ctx,
author_text=CONST.STRINGS["ping_author"],
description=CONST.STRINGS["ping_uptime"].format(unix_timestamp),
2024-07-17 11:47:26 +00:00
footer_text=CONST.STRINGS["ping_footer"].format(
round(1000 * self.client.latency),
),
)
await ctx.respond(embed=embed)