2024-07-17 12:01:12 +00:00
|
|
|
from datetime import datetime
|
|
|
|
|
2024-07-14 02:25:07 +00:00
|
|
|
from discord.ext import bridge
|
2024-07-17 12:01:12 +00:00
|
|
|
|
2024-07-14 02:25:07 +00:00
|
|
|
from lib.constants import CONST
|
2024-07-17 12:01:12 +00:00
|
|
|
from lib.embed_builder import EmbedBuilder
|
2024-07-14 02:25:07 +00:00
|
|
|
|
2024-07-17 11:47:26 +00:00
|
|
|
|
2024-07-14 02:25:07 +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),
|
|
|
|
),
|
2024-07-14 02:25:07 +00:00
|
|
|
)
|
|
|
|
await ctx.respond(embed=embed)
|
|
|
|
|
2024-07-17 11:47:26 +00:00
|
|
|
|
2024-07-14 02:25:07 +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
|
|
|
|
2024-07-14 02:25:07 +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),
|
|
|
|
),
|
2024-07-14 02:25:07 +00:00
|
|
|
)
|
|
|
|
await ctx.respond(embed=embed)
|