Save status_msg to accounts.json

Restore it if there is not any status_msg set on
the server
This commit is contained in:
vslg
2020-07-16 17:09:14 -03:00
parent 292d88a9bf
commit d57414c06c
5 changed files with 70 additions and 30 deletions

View File

@@ -194,6 +194,7 @@ class Accounts(JSONDataFile):
"device_id": client.device_id,
"enabled": True,
"presence": account.presence.value,
"status_msg": account.status_msg,
"order": account.order,
},
})
@@ -201,10 +202,11 @@ class Accounts(JSONDataFile):
async def update(
self,
user_id: str,
enabled: Optional[str] = None,
presence: Optional[str] = None,
order: Optional[int] = None,
user_id: str,
enabled: Optional[str] = None,
presence: Optional[str] = None,
order: Optional[int] = None,
status_msg: Optional[str] = None,
) -> None:
"""Update an account if found in the config file and write to disk."""
@@ -222,6 +224,9 @@ class Accounts(JSONDataFile):
if order is not None:
saved[user_id]["order"] = order
if status_msg is not None:
saved[user_id]["status_msg"] = status_msg
await self.write({**saved})