Fixed an error when trying to retrieve a deleted user while rendering a direct message

This commit is contained in:
Manuel Cortez 2019-02-15 09:04:52 -06:00
parent f512267b6d
commit 9763d8b26c

View File

@ -411,7 +411,11 @@ class Session(base.baseSession):
id str: User identifier, provided by Twitter. id str: User identifier, provided by Twitter.
returns an user dict.""" returns an user dict."""
if ("users" in self.db) == False or (id in self.db["users"]) == False: if ("users" in self.db) == False or (id in self.db["users"]) == False:
try:
user = self.twitter.show_user(id=id) user = self.twitter.show_user(id=id)
except TwythonError:
user = dict(screen_name="deleted_account", name="Deleted account")
return user
self.db["users"][user["id_str"]] = user self.db["users"][user["id_str"]] = user
return user return user
else: else: