🐛 修复 TETR.IO 默认头像传参错误

This commit is contained in:
2024-05-10 12:20:25 +08:00
parent 5bcecc0623
commit b0ee7fe6c7
2 changed files with 9 additions and 2 deletions

View File

@@ -312,7 +312,10 @@ class Processor(ProcessorMeta):
user=TETRIOInfo.User(
avatar=f'https://tetr.io/user-content/avatars/{user_info.data.user.id}.jpg?rv={user_info.data.user.avatar_revision}'
if user_info.data.user.avatar_revision is not None
else f'{{"type":"identicon","hash":"{md5(user_info.data.user.id.encode()).hexdigest()}"}}', # noqa: S324
else TETRIOInfo.User.Avatar(
type='identicon',
hash=md5(user_info.data.user.id.encode()).hexdigest(), # noqa: S324
),
name=user_name,
bio=user_info.data.user.bio,
),

View File

@@ -35,7 +35,11 @@ class Bind(BaseModel):
class TETRIOInfo(BaseModel):
class User(BaseModel):
avatar: str
class Avatar(BaseModel):
type: Literal['identicon']
hash: str
avatar: str | Avatar
name: str
bio: str | None