Fixed various hacks to account for serverside inconsistencies.

This commit is contained in:
flash 2024-05-09 21:34:06 +00:00
parent 7bc229de28
commit 82a5a9e292
3 changed files with 6 additions and 10 deletions

View file

@ -335,8 +335,7 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe
}
if(authorMethod === 'name') {
// the concat below should be done by the server, remove when fixed
const botUserInfo = Umi.Users.FindExact(author) ?? Umi.Users.FindExact(`~${author}`);
const botUserInfo = Umi.Users.FindExact(author);
author = new MamiMessageAuthorInfo(
Umi.User.isCurrentUser(botUserInfo),
botUserInfo,
@ -356,11 +355,11 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe
author = new MamiMessageAuthorInfo(
senderInfo.self,
rawUserInfo,
senderInfo.id ?? rawUserInfo.id,
senderInfo.name ?? rawUserInfo.name,
senderInfo.colour ?? rawUserInfo.colour,
senderInfo.perms?.rank ?? rawUserInfo.perms?.rank ?? 0,
senderInfo.avatar ?? rawUserInfo.avatar ?? new MamiUserAvatarInfo(senderInfo.id ?? rawUserInfo.id ?? '0'),
senderInfo.id ?? rawUserInfo?.id,
senderInfo.name ?? rawUserInfo?.name,
senderInfo.colour ?? rawUserInfo?.colour,
senderInfo.perms?.rank ?? rawUserInfo?.perms?.rank ?? 0,
senderInfo.avatar ?? rawUserInfo?.avatar ?? new MamiUserAvatarInfo(senderInfo.id ?? rawUserInfo?.id ?? '0'),
);
type = `message:${ev.detail.msg.flags.isAction ? 'action' : 'text'}`;

View file

@ -243,7 +243,6 @@ const SockChatS2CMessagePopulate = (ctx, timeStamp, userId, userName, userColour
args: botParts.slice(2),
};
// i think this is more Inaccurate Behaviour on the server side
if(info.msg.botInfo.type === 'say')
info.msg.botInfo.args[0] = SockChatUnfuckText(info.msg.botInfo.args[0]);
}

View file

@ -1,6 +1,4 @@
const SockChatUnfuckText = (text, isAction) => {
// P7.1 doesn't wrap in <i>, likely a bug in SharpChat
// check if this is the case with the PHPChat impl
if(isAction && text.startsWith('<i>'))
text = text.slice(3, -4);