Save account information on update

This commit is contained in:
Zeva Rose 2022-03-25 12:43:53 -06:00
parent d22e4f85a5
commit cb1d3809c8

View file

@ -93,7 +93,9 @@ async def twitter(bot: Snake, logger: Logger) -> None:
if account.last_sync + timedelta(hours=1) <= datetime.utcnow():
logger.debug(f"Account {account.handle} out of sync, updating")
user = api.get_user(user_id=account.twitter_id)
account.update(q(handle=user.screen_name, last_sync=datetime.utcnow()))
account.handle = user.screen_name
account.last_sync = datetime.utcnow()
await account.commit()
# Get new tweets
if tweets := api.user_timeline(user_id=account.twitter_id, since_id=account.last_tweet):