user_pref: 该 uid 对应 WavesUser.hide_uid_self_value, 由 caller 传入。 "on" 强制隐藏 / "off" 强制不隐藏 / "" 跟随全局 HideUid。
(uid, user_pref: str = "")
| 118 | |
| 119 | |
| 120 | def hide_uid(uid, user_pref: str = "") -> str: |
| 121 | """user_pref: 该 uid 对应 WavesUser.hide_uid_self_value, 由 caller 传入。 |
| 122 | |
| 123 | "on" 强制隐藏 / "off" 强制不隐藏 / "" 跟随全局 HideUid。 |
| 124 | """ |
| 125 | from ..roversign_config.roversign_config import RoverSignConfig |
| 126 | |
| 127 | uid_str = str(uid) if uid is not None else "" |
| 128 | if user_pref == "off": |
| 129 | return uid_str |
| 130 | if user_pref != "on": |
| 131 | if not RoverSignConfig.get_config("HideUid").data: |
| 132 | return uid_str |
| 133 | if len(uid_str) < 2: |
| 134 | return uid_str |
| 135 | return uid_str[:2] + "*" * 4 + uid_str[-2:] |
| 136 | |
| 137 | |
| 138 | async def get_hide_uid_pref(uid: str, user_id: str, bot_id: str, game_id=None) -> str: |
no outgoing calls
no test coverage detected