Merge branch 'develop' into refresh
This commit is contained in:
commit
2d90288856
2 changed files with 7 additions and 4 deletions
|
@ -30,7 +30,7 @@
|
||||||
"baguette",
|
"baguette",
|
||||||
"physics textbook",
|
"physics textbook",
|
||||||
"toaster",
|
"toaster",
|
||||||
"portrait of Mark Harmon",
|
"portrait of Richard Stallman",
|
||||||
"television",
|
"television",
|
||||||
"mau5head",
|
"mau5head",
|
||||||
"five ton truck",
|
"five ton truck",
|
||||||
|
|
|
@ -76,12 +76,15 @@ def mcping_modern(host, port):
|
||||||
data = json.loads(d.decode('utf8'))
|
data = json.loads(d.decode('utf8'))
|
||||||
try:
|
try:
|
||||||
version = data["version"]["name"]
|
version = data["version"]["name"]
|
||||||
desc = data["description"]
|
if data["description"].get("text", None):
|
||||||
|
desc = u" ".join(data["description"]["text"].split())
|
||||||
|
else:
|
||||||
|
desc = u" ".join(data["description"].split())
|
||||||
max_players = data["players"]["max"]
|
max_players = data["players"]["max"]
|
||||||
online = data["players"]["online"]
|
online = data["players"]["online"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return "Invalid data: {}; error: {}".format(data, e)
|
return "Invalid data: {}; error: {}".format(data, e)
|
||||||
return mc_color_format(u"{}\x0f - {}\x0f - {}/{} players *".format(desc, version, online,
|
return mc_color_format(u"{}\x0f - {}\x0f - {}/{} players.".format(desc, version, online,
|
||||||
max_players)).replace("\n", u"\x0f - ")
|
max_players)).replace("\n", u"\x0f - ")
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue