If get_user is called with a full user object as an argument, logs it and changes the object to be only the user_id

This commit is contained in:
Manuel Cortez 2021-06-27 16:03:36 -05:00
parent 0612c653b8
commit 002e1ccb55

View File

@ -398,6 +398,9 @@ class Session(base.baseSession):
""" Returns an user object associated with an ID.
id str: User identifier, provided by Twitter.
returns a tweepy user object."""
if hasattr(id, "id_str"):
log.error("Called get_user function by passing a full user id as a parameter.")
id = id.id_str
if ("users" in self.db) == False or (str(id) in self.db["users"]) == False:
log.debug("Requesting user id {} as it is not present in the users database.".format(id))
try: