diff --git a/mcstatus/pinger.py b/mcstatus/pinger.py index 818ad56..58b362d 100644 --- a/mcstatus/pinger.py +++ b/mcstatus/pinger.py @@ -139,8 +139,20 @@ def __init__(self, raw): if "description" not in raw: raise ValueError("Invalid status object (no 'description' value)") - self.description = raw["description"] - self.description_clean = re.sub(r'\u00A7.', '', raw["description"]) + # for newer versions of minecraft + + if isinstance(raw["description"], string_types): + self.description = raw["description"] + self.description_clean = re.sub(r'\u00A7.', '', raw["description"]) + + elif isinstance(raw["description"], dict): + self.description = raw["description"]["text"] + self.description_clean = re.sub(r'\u00A7.', '', + raw["description"]["text"]) + + else: + raise ValueError("Invalid status object " + "(unknown 'description' type)") if "favicon" in raw: self.favicon = raw["favicon"]