diff --git a/mtgcardlookup.py b/mtgcardlookup.py index a11270c..239a6d5 100755 --- a/mtgcardlookup.py +++ b/mtgcardlookup.py @@ -2,6 +2,7 @@ import os # Used exactly once to check for the config file import shutil # Used exactly once to copy the sample config file +import time import asyncio import aiohttp import re @@ -260,16 +261,23 @@ async def update_followers(c, me): # in case someone followed while the bot was down or something. log(f'{len(to_follow)} accounts to follow:') for account in to_follow: + log(f'Following {account}...') + account_dict = await c.get(f'/api/v1/accounts/{account}') + moved_to = account_dict.get('moved') + if moved_to: + log('Account has moved, skipping...') + continue await c.account_follow(account) - log(f'Followed {account}') + time.sleep(1) else: log('No accounts to follow.') if to_unfollow: log(f'{len(to_unfollow)} accounts to unfollow:') for account in to_unfollow: - await c.account_unfollow(account) - log(f'Unfollowed {account}') + log(f'Unfollowing {account}...') + await c.account_follow(account) + time.sleep(1) else: log('No accounts to unfollow.')