New feature! unfollow unfollowing accounts

This commit is contained in:
spla 2023-05-02 20:22:33 +02:00
parent 67faa9fc99
commit 45d795e947
2 changed files with 19 additions and 2 deletions

View File

@ -18,3 +18,4 @@ Within Python Virtual Environment:
3. Use your favourite scheduling method to set `python followers.py` to run and desired pace.
2.4.23 - New feature! post of unfollowing accounts
2.5.23 - New feature! unfollow unfollowing accounts

View File

@ -88,13 +88,29 @@ if __name__ == '__main__':
post_text = f"@{mastodon.me().acct}\nseguidors: {len(followers)}\n"
post_text += f"locals: {local_followers} ({local_incr})\nremots: {remote_followers} ({remote_incr})"
post_text += f"locals: {local_followers} ({local_incr})\nremots: {remote_followers} ({remote_incr})\n"
if unfollowers != None:
post_text += f'\nJa no et segueix:\n'
for unfollow in unfollowers:
post_text += f'\nJa no et segueix:\n@{unfollow}'
post_text += f'- {unfollow}'
unfollow_id = mastodon.account_lookup(unfollow).id
try:
mastodon.account_unfollow(unfollow_id)
post_text += f' (has deixat de seguir-lo)\n'
except:
post_text += f' (ja no existeix)\n'
pass
mastodon.status_post(post_text, in_reply_to_id=None, visibility='direct')