1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-12 00:50:53 +00:00
* Added: Setting to automatically accept content warnings when opening a stream.
* Added: Three settings to control the appearance of Hype Chat messages.
* Changed: Added a few keywords to settings entries in the `Data Management` category for better search support.
* Developer: The chat and pubsub logging utility can now inject pubsub messages for testing.
This commit is contained in:
SirStendec 2023-06-26 13:11:27 -04:00
parent eea9d51bdc
commit 7f109b4b48
11 changed files with 273 additions and 16 deletions

View file

@ -599,6 +599,21 @@ export default class ChatHook extends Module {
}
});
this.settings.add('chat.hype.message-style', {
default: 1,
ui: {
path: 'Chat > Hype Chat >> Appearance',
title: 'Hype Chat Style',
component: 'setting-select-box',
description: '**Note**: Hype Chats that include messages will always have their messages displayed, regardless of setting. Changes made to this setting may not affect existing chat messages.',
data: [
{value: 0, title: 'Do Not Display'},
{value: 1, title: 'Standard Twitch (Large, Colored, Limited FFZ Support)'},
{value: 2, title: 'Minimal (Marked with System Message, No Colors)' }
]
}
});
this.settings.add('chat.subs.show', {
default: 3,
ui: {
@ -1421,6 +1436,11 @@ export default class ChatHook extends Module {
if ( event.prefix !== 'community-points-channel-v1' || this.disable_handling )
return;
if ( event.prefix === 'pinned-chat-updates-v1' ) {
this.log.info('Pinned Chat', event);
return;
}
const service = this.ChatService.first,
message = event.message,
data = message?.data?.redemption;
@ -2359,6 +2379,43 @@ export default class ChatHook extends Module {
return old_state.call(i, e);
}
const old_pinned = this.onPinnedChatEvent;
this.onPinnedChatEvent = function(e) {
try {
const setting = t.chat.context.get('chat.hype.message-style');
if ( setting !== 1 ) {
// Drop messages with no message if we're not displaying them.
if ( e.isSystemMessage && setting === 0 )
return;
const out = i.convertMessage(e);
out.ffz_type = 'hype';
out.hype_amount = e.amount;
out.hype_canonical_amount = e.canonical_amount;
out.hype_currency = e.currency;
out.hype_exponent = e.exponent;
out.hype_level = e.level;
if ( e.isSystemMessage ) {
// Delete the message it comes with.
out.message = '';
out.messageBody = '';
out.messageParts = [];
e.message.body = '';
}
//t.log.info('Pinned Event', e, out);
return i.postMessageToCurrentChannel(e, out);
}
} catch(err) {
t.log.capture(err, {extra: e});
}
return old_pinned.call(i, e);
}
const old_resub = this.onResubscriptionEvent;
this.onResubscriptionEvent = function(e) {
try {