Skip to content

Commit

Permalink
get pinned tweet if using guest token
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoszek committed Dec 4, 2022
1 parent 2ade63b commit 5b29832
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion docs/gettingstarted/beforerunning.md
Expand Up @@ -19,7 +19,6 @@ The bot will automatically obtain them on its own when no `twitter_token` mappin
It has certain limitations, however:

- Only gathers the latest 20 tweets for each account in every run
- No access to pinned status for tweets
- No access to tweets from protected accounts

To get started with Guest Tokens you'll just need to obtain the [Fediverse tokens](/pleroma-bot/gettingstarted/beforerunning/#fediverse-tokens) and create a [configuration file](/pleroma-bot/gettingstarted/configuration/).
Expand Down
3 changes: 3 additions & 0 deletions pleroma_bot/_twitter.py
Expand Up @@ -145,6 +145,8 @@ def _get_twitter_info_guest(self): # pragma: todo
if "url" in user_twitter["entities"]:
wb = user_twitter["entities"]["url"]["urls"][0]["expanded_url"]
self.website = wb
if "pinned_tweet_ids" in user_twitter:
self.pinned_tweet_id = user_twitter["pinned_tweet_ids_str"][0]


def _get_twitter_info(self):
Expand Down Expand Up @@ -288,6 +290,7 @@ def _package_tweet_v2(tweet_v1): # pragma: todo
entities = tweet_v1["entities"]

card = {}
tweet_v1["polls"] = {}
if "card" in tweet_v1.keys():
tw_card = tweet_v1["card"]
if "binding_values" in tw_card.keys():
Expand Down

0 comments on commit 5b29832

Please sign in to comment.