refactor(project): remove useless getattr

This commit is contained in:
MingxuanGame
2025-10-04 06:43:55 +00:00
parent c6058eb0d8
commit ca7c74f709
9 changed files with 24 additions and 29 deletions

View File

@@ -118,10 +118,7 @@ class ChannelMessageBase(NotificationDetail):
channel_type: "ChannelType",
) -> Self:
try:
avatar_url = (
getattr(user, "avatar_url", "https://lazer-data.g0v0.top/default.jpg")
or "https://lazer-data.g0v0.top/default.jpg"
)
avatar_url = user.avatar_url or "https://lazer-data.g0v0.top/default.jpg"
except Exception:
avatar_url = "https://lazer-data.g0v0.top/default.jpg"
instance = cls(