Skip to content

Commit

Permalink
Merge pull request #47 from robertoszek/develop
Browse files Browse the repository at this point in the history
Bump to v0.8.8
  • Loading branch information
robertoszek authored May 15, 2021
2 parents 857346c + 9bb7aa5 commit d559074
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.8.8] - 2021-05-15
## Added
- ```twitter_bio``` for allowing the user to choose if they want to retrieve and append the Twitter bio to their Fediverse user or not.

## [0.8.7] - 2021-05-01
## Added
- ```delay_post``` mapping, for setting how long to wait (in seconds) between each post request to avoid hitting rate limits of the target Fediverse instance
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include pleroma_bot/locale *.mo
2 changes: 2 additions & 0 deletions docs/gettingstarted/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Every mapping that ```pleroma-bot``` understands is listed below with a descript
| file_max_size | Yes | | How big attachments can be before being ignored. Examples: "30MB", "1.5GB", "0.5TB" |
| delay_post | Yes | 0.5 | How long to wait (in seconds) between submitting posts to the Fedi instance (useful when trying to avoid rate limits)|
| tweet_ids | Yes | | List of specific tweet IDs to retrieve and post |
| twitter_bio | Yes | true | Append Twitter's bio to Pleroma/Mastodon target user |



There a few mapping *exclusive* to users:
Expand Down
2 changes: 1 addition & 1 deletion pleroma_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import locale
import logging

__version__ = "0.8.7"
__version__ = "0.8.8"


class StdOutFilter(logging.Filter):
Expand Down
6 changes: 5 additions & 1 deletion pleroma_bot/_twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def _get_twitter_info(self):
if not response.ok:
response.raise_for_status()
user_twitter = json.loads(response.text)
self.bio_text = f'{self.bio_text}{user_twitter["description"]}'
self.bio_text = (
f'{self.bio_text}{user_twitter["description"]}'
if self.twitter_bio
else f'{self.bio_text}'
)
# Check if user has profile image
if "profile_image_url_https" in user_twitter.keys():
self.profile_image_url = user_twitter["profile_image_url_https"]
Expand Down
6 changes: 6 additions & 0 deletions pleroma_bot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def __init__(self, user_cfg: dict, cfg: dict, base_path: str):
except KeyError:
self.twitter_base_url_v2 = "https://api.twitter.com/2"
pass
try:
if not hasattr(self, "twitter_bio"):
self.twitter_bio = cfg["twitter_bio"]
except KeyError:
self.twitter_bio = True
pass
try:
if not hasattr(self, "nitter_base_url"):
self.nitter_base_url = cfg["nitter_base_url"]
Expand Down
1 change: 1 addition & 0 deletions pleroma_bot/tests/test_files/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ users:
pleroma_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
signature: true
media_upload: false
twitter_bio: false
consumer_key: xxxxxxxxxxxxxxxxxxxxxxxxx
consumer_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
access_token_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Expand Down
1 change: 1 addition & 0 deletions pleroma_bot/tests/test_files/config_delay_post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pleroma_base_url: https://pleroma.robertoszek.xyz
# Twitter's API hard limit is 3,200
max_tweets: 40
delay_post: 2
twitter_bio: false
# Twitter bearer token
twitter_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# List of users and their attributes
Expand Down

0 comments on commit d559074

Please sign in to comment.