Fixed various hacks to account for serverside inconsistencies.
This commit is contained in:
parent
7bc229de28
commit
82a5a9e292
3 changed files with 6 additions and 10 deletions
|
@ -335,8 +335,7 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe
|
||||||
}
|
}
|
||||||
|
|
||||||
if(authorMethod === 'name') {
|
if(authorMethod === 'name') {
|
||||||
// the concat below should be done by the server, remove when fixed
|
const botUserInfo = Umi.Users.FindExact(author);
|
||||||
const botUserInfo = Umi.Users.FindExact(author) ?? Umi.Users.FindExact(`~${author}`);
|
|
||||||
author = new MamiMessageAuthorInfo(
|
author = new MamiMessageAuthorInfo(
|
||||||
Umi.User.isCurrentUser(botUserInfo),
|
Umi.User.isCurrentUser(botUserInfo),
|
||||||
botUserInfo,
|
botUserInfo,
|
||||||
|
@ -356,11 +355,11 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe
|
||||||
author = new MamiMessageAuthorInfo(
|
author = new MamiMessageAuthorInfo(
|
||||||
senderInfo.self,
|
senderInfo.self,
|
||||||
rawUserInfo,
|
rawUserInfo,
|
||||||
senderInfo.id ?? rawUserInfo.id,
|
senderInfo.id ?? rawUserInfo?.id,
|
||||||
senderInfo.name ?? rawUserInfo.name,
|
senderInfo.name ?? rawUserInfo?.name,
|
||||||
senderInfo.colour ?? rawUserInfo.colour,
|
senderInfo.colour ?? rawUserInfo?.colour,
|
||||||
senderInfo.perms?.rank ?? rawUserInfo.perms?.rank ?? 0,
|
senderInfo.perms?.rank ?? rawUserInfo?.perms?.rank ?? 0,
|
||||||
senderInfo.avatar ?? rawUserInfo.avatar ?? 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'}`;
|
type = `message:${ev.detail.msg.flags.isAction ? 'action' : 'text'}`;
|
||||||
|
|
|
@ -243,7 +243,6 @@ const SockChatS2CMessagePopulate = (ctx, timeStamp, userId, userName, userColour
|
||||||
args: botParts.slice(2),
|
args: botParts.slice(2),
|
||||||
};
|
};
|
||||||
|
|
||||||
// i think this is more Inaccurate Behaviour on the server side
|
|
||||||
if(info.msg.botInfo.type === 'say')
|
if(info.msg.botInfo.type === 'say')
|
||||||
info.msg.botInfo.args[0] = SockChatUnfuckText(info.msg.botInfo.args[0]);
|
info.msg.botInfo.args[0] = SockChatUnfuckText(info.msg.botInfo.args[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
const SockChatUnfuckText = (text, isAction) => {
|
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>'))
|
if(isAction && text.startsWith('<i>'))
|
||||||
text = text.slice(3, -4);
|
text = text.slice(3, -4);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue