diff --git a/app/models/notification.py b/app/models/notification.py index dbfcaa3..dd7aaa9 100644 --- a/app/models/notification.py +++ b/app/models/notification.py @@ -117,10 +117,14 @@ class ChannelMessageBase(NotificationDetail): receiver: list[int], 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' + except Exception: + avatar_url = 'https://lazer-data.g0v0.top/default.jpg' instance = cls( title=truncate(message.content, CONTENT_TRUNCATE), type=channel_type.value.lower(), - cover_url=user.avatar_url, + cover_url=avatar_url, ) instance._message = message instance._user = user