From ea17f85db708e332d1df5c3fde4b2918c96a0530 Mon Sep 17 00:00:00 2001 From: Jimbo <17926797+Kapppa@users.noreply.github.com> Date: Sat, 27 Apr 2024 21:50:46 +0100 Subject: [PATCH] fix emojis in tracker status --- chiya/utils/trackerstatus.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/chiya/utils/trackerstatus.py b/chiya/utils/trackerstatus.py index 1b31c0e8..edaec3e4 100644 --- a/chiya/utils/trackerstatus.py +++ b/chiya/utils/trackerstatus.py @@ -28,14 +28,14 @@ async def do_refresh(self, session: aiohttp.ClientSession) -> None: def get_embed_color(self, embed: discord.Embed): status = list(set([field.value for field in embed.fields])) if len(status) == 1: - if status[0] == "<:status_online:596576749790429200> Online": + if status[0] == "🟢 Online": return discord.Color.green() - elif status[0] == "<:status_dnd:596576774364856321> Unstable": + elif status[0] == "🟠 Unstable": return discord.Color.orange() - elif status[0] == "<:status_offline:596576752013279242> Offline": + elif status[0] == "🔴 Offline": return discord.Color.red() else: - if "<:status_online:596576749790429200> Online" not in status: + if "🟢 Online" not in status: return discord.Color.red() else: return discord.Color.orange() @@ -85,11 +85,11 @@ def normalize_value(self, value): """ match value: case "1": - return "<:status_online:596576749790429200> Online" + return "🟢 Online" case "2": - return "<:status_dnd:596576774364856321> Unstable" + return "🟠 Unstable" case "0": - return "<:status_offline:596576752013279242> Offline" + return "🔴 Offline" class TrackerStatusAB(TrackerStatus): @@ -110,7 +110,7 @@ def get_status_embed(self, ctx: discord.Interaction = None) -> discord.Embed: self.do_refresh() if not self.cache_data.get("status", False): - embed.set_footer("<:status_offline:596576752013279242> API Failed") + embed.set_footer("🔴 API Failed") for key, value in self.cache_data.get("status", {}).items(): embed.add_field(name=key, value=self.normalize_value(value.get("status")), inline=True) @@ -125,11 +125,11 @@ def normalize_value(self, value): """ match value: case 1: - return "<:status_online:596576749790429200> Online" + return "🟢 Online" case 2: - return "<:status_dnd:596576774364856321> Unstable" + return "🟠 Unstable" case 0: - return "<:status_offline:596576752013279242> Offline" + return "🔴 Offline" class TrackerStatusUptimeRobot(TrackerStatus): @@ -163,16 +163,13 @@ def normalize_value(self, value: dict): Converts API data values into user-friendly text with status availability icon. """ if value.get("label") == "success": - return "<:status_online:596576749790429200> Online" + return "🟢 Online" ratio = float(value.get("ratio", "0")) if float(value.get("ratio")) > 95: - return "<:status_dnd:596576774364856321> Unstable" + return "🟠 Unstable" elif ratio > 0: - return "<:status_offline:596576752013279242> Offline" - - return "<:status_offline:596576752013279242> Unknown" - - + return "🔴 Offline" + return "🔴 Unknown" class TrackerStatusMAM(TrackerStatusUptimeRobot): def __init__(self) -> None: super().__init__("MAM", "https://status.myanonamouse.net/api/getMonitorList/vl59BTEJX")