diff --git a/src/mami.js/sockchat/handlers.js b/src/mami.js/sockchat/handlers.js index 2c15b69..7ddf8c4 100644 --- a/src/mami.js/sockchat/handlers.js +++ b/src/mami.js/sockchat/handlers.js @@ -360,7 +360,7 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe senderInfo.name ?? rawUserInfo.name, senderInfo.colour ?? rawUserInfo.colour, senderInfo.perms?.rank ?? rawUserInfo.perms?.rank ?? 0, - new MamiUserAvatarInfo(senderInfo.id ?? rawUserInfo.id ?? '0'), + senderInfo.avatar ?? rawUserInfo.avatar ?? new MamiUserAvatarInfo(senderInfo.id ?? rawUserInfo.id ?? '0'), ); type = `message:${ev.detail.msg.flags.isAction ? 'action' : 'text'}`; diff --git a/src/mami.js/users.js b/src/mami.js/users.js index 2f7b7fc..4ba7651 100644 --- a/src/mami.js/users.js +++ b/src/mami.js/users.js @@ -28,8 +28,10 @@ const MamiUserStatusInfo = function(isAway = false, message = '') { }; }; -const MamiUserAvatarInfo = function(userId) { +const MamiUserAvatarInfo = function(userId = null) { userId ??= ''; + if(typeof userId !== 'string') + throw 'userId must be a string or null'; const template = futami.get('avatar') ?? ''; const changeTime = Date.now();