mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
Compare commits
3 Commits
09c0fd4650
...
daf7d2dedd
Author | SHA1 | Date | |
---|---|---|---|
|
daf7d2dedd | ||
|
472fb9f6ac | ||
|
b0bd20ea7f |
@ -105,8 +105,8 @@ class Client(DBClient):
|
|||||||
sync=bool(sync),
|
sync=bool(sync),
|
||||||
autojoin=bool(autojoin),
|
autojoin=bool(autojoin),
|
||||||
online=bool(online),
|
online=bool(online),
|
||||||
displayname=displayname,
|
displayname=(displayname if displayname != "" else None),
|
||||||
avatar_url=avatar_url,
|
avatar_url=(avatar_url if avatar_url != "" else None),
|
||||||
)
|
)
|
||||||
self._postinited = False
|
self._postinited = False
|
||||||
|
|
||||||
@ -287,9 +287,9 @@ class Client(DBClient):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
await self.update()
|
await self.update()
|
||||||
if self.displayname != "disable":
|
if self.displayname not in ("disable", None):
|
||||||
await self.client.set_displayname(self.displayname)
|
await self.client.set_displayname(self.displayname)
|
||||||
if self.avatar_url != "disable":
|
if self.avatar_url not in ("disable", None):
|
||||||
await self.client.set_avatar_url(self.avatar_url)
|
await self.client.set_avatar_url(self.avatar_url)
|
||||||
if self.crypto:
|
if self.crypto:
|
||||||
await self._start_crypto()
|
await self._start_crypto()
|
||||||
@ -376,7 +376,7 @@ class Client(DBClient):
|
|||||||
await self.update()
|
await self.update()
|
||||||
|
|
||||||
async def update_displayname(self, displayname: str | None, save: bool = True) -> None:
|
async def update_displayname(self, displayname: str | None, save: bool = True) -> None:
|
||||||
if displayname is None or displayname == self.displayname:
|
if displayname == self.displayname:
|
||||||
return
|
return
|
||||||
self.displayname = displayname
|
self.displayname = displayname
|
||||||
if self.displayname != "disable":
|
if self.displayname != "disable":
|
||||||
@ -387,7 +387,7 @@ class Client(DBClient):
|
|||||||
await self.update()
|
await self.update()
|
||||||
|
|
||||||
async def update_avatar_url(self, avatar_url: ContentURI, save: bool = True) -> None:
|
async def update_avatar_url(self, avatar_url: ContentURI, save: bool = True) -> None:
|
||||||
if avatar_url is None or avatar_url == self.avatar_url:
|
if avatar_url == self.avatar_url:
|
||||||
return
|
return
|
||||||
self.avatar_url = avatar_url
|
self.avatar_url = avatar_url
|
||||||
if self.avatar_url != "disable":
|
if self.avatar_url != "disable":
|
||||||
|
@ -44,8 +44,8 @@ class Client(SyncStore):
|
|||||||
autojoin: bool
|
autojoin: bool
|
||||||
online: bool
|
online: bool
|
||||||
|
|
||||||
displayname: str
|
displayname: str | None
|
||||||
avatar_url: ContentURI
|
avatar_url: ContentURI | None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _from_row(cls, row: Record | None) -> Client | None:
|
def _from_row(cls, row: Record | None) -> Client | None:
|
||||||
@ -71,8 +71,8 @@ class Client(SyncStore):
|
|||||||
self.sync,
|
self.sync,
|
||||||
self.autojoin,
|
self.autojoin,
|
||||||
self.online,
|
self.online,
|
||||||
self.displayname,
|
self.displayname or "",
|
||||||
self.avatar_url,
|
self.avatar_url or "",
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# The full URI to the database. SQLite and Postgres are fully supported.
|
# The full URI to the database. SQLite and Postgres are fully supported.
|
||||||
# Other DBMSes supported by SQLAlchemy may or may not work.
|
|
||||||
# Format examples:
|
# Format examples:
|
||||||
# SQLite: sqlite:filename.db
|
# SQLite: sqlite:filename.db
|
||||||
# Postgres: postgresql://username:password@hostname/dbname
|
# Postgres: postgresql://username:password@hostname/dbname
|
||||||
|
Loading…
Reference in New Issue
Block a user