From 66dd9d3ab8e66a4c80f290ea927c2731c17e697c Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Thu, 8 Feb 2024 03:34:24 +0800 Subject: [PATCH] Resolve minecraft fail to query issue --- discordgsm/protocols/minecraft.py | 24 ++++++++++++------------ requirements.txt | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/discordgsm/protocols/minecraft.py b/discordgsm/protocols/minecraft.py index 40823c8..a4fc474 100644 --- a/discordgsm/protocols/minecraft.py +++ b/discordgsm/protocols/minecraft.py @@ -22,18 +22,18 @@ async def query(self): if isinstance(status["description"], str): name = status["description"] - - if "text" in status["description"] and isinstance( - status["description"]["text"], str - ): - name = status["description"]["text"] - - if "extra" in status["description"] and isinstance( - status["description"]["extra"], list - ): - name = "".join( - data.get("text", "") for data in status["description"]["extra"] - ) + else: + if "text" in status["description"] and isinstance( + status["description"]["text"], str + ): + name = status["description"]["text"] + + if "extra" in status["description"] and isinstance( + status["description"]["extra"], list + ): + name = "".join( + data.get("text", "") for data in status["description"]["extra"] + ) name = "\n".join(row.strip() for row in name.split("\n")) players = [ diff --git a/requirements.txt b/requirements.txt index 25b47fd..9cba993 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ backports.zoneinfo==0.2.1;python_version<"3.9" discord.py==2.3.2 flask[async]==3.0.2 gunicorn==21.2.0 -opengsq==3.0.9 +opengsq==3.0.10 psycopg2-binary==2.9.9 pymongo==4.6.1 python-dotenv==1.0.1