diff --git a/appservice.py b/appservice.py index 66d2e5f..c6b0459 100644 --- a/appservice.py +++ b/appservice.py @@ -142,6 +142,6 @@ def get_displayname(userid): r = requests.get(url) if r.status_code == 200: data = json.loads(r.text) - return data["displayname"] - else: - return userid \ No newline at end of file + if 'displayname' in data: + return data["displayname"] + return userid