telegram icon indicating copy to clipboard operation
telegram copied to clipboard

Support more flexible displayname_preferences

Open xiaq opened this issue 4 years ago • 1 comments

I would like to show both the username and full name of Telegram users in the display names of their puppets, like username (First Last). But instead of adding this as another option to the possible values to displayname_preferences, what about the following:

  • Make the elements of displayname_preferences format strings. So the format I'd like to implement will be {username} ({first_name} {last_name}).

  • If any of the variables referenced in the format string does not exist, the next one is tried. For example, suppose that the list of displayname_preferences is:

    - {username} ({first_name} {last_name})
    - {username} ({first_name})
    - {username}
    

    If the user has a username, first name and last_name; the first one is chosen. If they don't have a last name, the first one is skipped and the second one is chosen. If they have neither first name nor last name, the last one is chosen.

    This is similar to how the preferences are used now, just a bit more sophisticated.

  • The current supported values are translated internally to format strings, when matched exactly; for example, username translates to {username}, but username: {username} is not translated.

If this is a good idea, I can try to implement this.

xiaq avatar Feb 10 '21 21:02 xiaq

It seems to be good idea, I'd like to have both - usernames and full names in puppet name

JuniorJPDJ avatar Feb 13 '21 22:02 JuniorJPDJ