diff --git a/src/sessions/twitter/compose.py b/src/sessions/twitter/compose.py index 98370391..89dc6f16 100644 --- a/src/sessions/twitter/compose.py +++ b/src/sessions/twitter/compose.py @@ -77,8 +77,6 @@ def compose_tweet(tweet, db, relative_times, show_screen_names=False, session=No return [user+", ", text, ts+", ", source] def compose_direct_message(item, db, relative_times, show_screen_names=False, session=None): - # for a while this function will be together with compose_dm. - # this one composes direct messages based on events (new API Endpoints). if system == "Windows": # Let's remove the last 3 digits in the timestamp string. # Twitter sends their "epoch" timestamp with 3 digits for milliseconds and arrow doesn't like it. diff --git a/src/sessions/twitter/session.py b/src/sessions/twitter/session.py index ff2badbf..7dd1fb79 100644 --- a/src/sessions/twitter/session.py +++ b/src/sessions/twitter/session.py @@ -11,6 +11,7 @@ import application from pubsub import pub import tweepy from tweepy.error import TweepError +from tweepy.models import User as UserModel from mysc.thread_utils import call_threaded from keys import keyring from sessions import base @@ -404,13 +405,16 @@ class Session(base.baseSession): def get_user(self, id): """ Returns an user object associated with an ID. id str: User identifier, provided by Twitter. - returns an user dict.""" + returns a tweepy user object.""" if ("users" in self.db) == False or (id in self.db["users"]) == False: try: user = self.twitter.get_user(id=id) except TweepError as err: - user = dict(screen_name="deleted_account", name="Deleted account") - return user + user = UserModel(None) + user.screen_name = "deleted_user" + user.id = id + user.name = _("Deleted account") + user.id_str = id self.db["users"][user.id_str] = user return user else: