Save account information on update
This commit is contained in:
parent
d22e4f85a5
commit
cb1d3809c8
1 changed files with 3 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue