Actually apply displayname_template

Also get rid of displayname_preference until it's implemented
This commit is contained in:
Andrew Ferrazzutti 2022-04-23 13:55:55 -04:00
parent 51d02d3c34
commit 9dd11efc2d
3 changed files with 1 additions and 9 deletions

View File

@ -71,7 +71,6 @@ class Config(BaseBridgeConfig):
copy("bridge.username_template")
copy("bridge.displayname_template")
copy("bridge.displayname_preference")
copy("bridge.command_prefix")
copy("bridge.initial_chat_sync")

View File

@ -97,14 +97,6 @@ bridge:
# as defined below in displayname_preference.
# Keys available for displayname_preference are also available here.
displayname_template: "{displayname} (KT)"
# Available keys: TODO
# "name" (full name)
# "first_name"
# "last_name"
# "nickname"
# "own_nickname" (user-specific!)
displayname_preference:
- nickname
# The prefix for commands. Only required in non-management rooms.
command_prefix: "!kt"

View File

@ -193,6 +193,7 @@ class Puppet(DBPuppet, BasePuppet):
return self
async def _update_name(self, name: str) -> bool:
name = self.config["bridge.displayname_template"].format(displayname=name)
if name != self.name or not self.name_set:
self.name = name
try: