mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-01 23:48:31 +00:00
4.0.0-rc4.5
* Added: Whisper Support * Fixed: UI missing hover state for a few elements added by FrankerFaceZ. * Fixed: Handle missing badge definition when rendering FFZ badges. * Fixed: Update static chat message type mappings. * Fixed: Error in metadata when unable to get the proper player. * Fixed: Incorrectly applying dark theme to products page. A bit more work on getting enhanced viewer cards ready.
This commit is contained in:
parent
4a326823b9
commit
17fb41f083
26 changed files with 396 additions and 80 deletions
|
@ -566,6 +566,43 @@ export default class Chat extends Module {
|
|||
}
|
||||
|
||||
|
||||
standardizeWhisper(msg) { // eslint-disable-line class-methods-use-this
|
||||
if ( ! msg )
|
||||
return msg;
|
||||
|
||||
if ( msg._ffz_message )
|
||||
return msg._ffz_message;
|
||||
|
||||
const emotes = {},
|
||||
is_action = msg.content.startsWith('/me '),
|
||||
offset = is_action ? 4 : 0,
|
||||
|
||||
out = msg._ffz_message = {
|
||||
user: msg.from,
|
||||
message: msg.content.slice(offset),
|
||||
is_action,
|
||||
emotes,
|
||||
timestamp: msg.sentAt && msg.sentAt.getTime(),
|
||||
deleted: false
|
||||
};
|
||||
|
||||
out.user.color = out.user.chatColor;
|
||||
|
||||
if ( Array.isArray(msg.emotes) && msg.emotes.length )
|
||||
for(const emote of msg.emotes) {
|
||||
const id = emote.emoteID,
|
||||
em = emotes[id] = emotes[id] || [];
|
||||
|
||||
em.push({
|
||||
startIndex: emote.from - offset,
|
||||
endIndex: emote.to - offset
|
||||
});
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
standardizeMessage(msg) { // eslint-disable-line class-methods-use-this
|
||||
if ( ! msg )
|
||||
return msg;
|
||||
|
@ -574,6 +611,9 @@ export default class Chat extends Module {
|
|||
if ( msg.sender && ! msg.user )
|
||||
msg.user = msg.sender;
|
||||
|
||||
if ( msg.from && ! msg.user )
|
||||
msg.user = msg.from;
|
||||
|
||||
let user = msg.user;
|
||||
if ( ! user )
|
||||
user = msg.user = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue