1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00
* Added: Option to hide Community Gift Chest elements from chat.
* Fixed: Users not seeing the reason they were timed out or banned from chat.
This commit is contained in:
SirStendec 2019-09-23 12:17:51 -04:00
parent 89d243a269
commit ba1da9a774
3 changed files with 78 additions and 32 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.10.0", "version": "4.11.0",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View file

@ -665,7 +665,7 @@ export default class Badges extends Module {
b = {}; b = {};
for(const data of badges) { for(const data of badges) {
const sid = data.setID, const sid = data.setID,
bs = b[sid] = b[sid] || {__game: /_\d+$/.test(sid)}; bs = b[sid] = b[sid] || {__game: /_\d+$/.test(sid) && ! sid.includes('overwatch') };
this.twitch_badge_count++; this.twitch_badge_count++;
bs[data.version] = data; bs[data.version] = data;

View file

@ -229,8 +229,23 @@ export default class ChatHook extends Module {
Twilight.CHAT_ROUTES Twilight.CHAT_ROUTES
); );
this.CommunityChestBanner = this.fine.define(
'community-chest-banner',
n => n.getLastGifterText && n.getBannerText && has(n, 'finalCount'),
Twilight.CHAT_ROUTES
);
// Settings // Settings
this.settings.add('chat.community-chest.show', {
default: true,
ui: {
path: 'Chat > Appearance >> Community Chest',
title: 'Display the Community Gift Chest banner.',
component: 'setting-check-box'
}
});
this.settings.add('chat.points.show-callouts', { this.settings.add('chat.points.show-callouts', {
default: true, default: true,
ui: { ui: {
@ -585,6 +600,12 @@ export default class ChatHook extends Module {
} }
}, this); }, this);
this.chat.context.on('changed:chat.community-chest.show', () => {
this.CommunityChestBanner.forceUpdate();
this.CalloutSelector.forceUpdate();
}, this);
this.chat.context.on('changed:chat.lines.alternate', val => { this.chat.context.on('changed:chat.lines.alternate', val => {
this.css_tweaks.toggle('chat-rows', val); this.css_tweaks.toggle('chat-rows', val);
this.updateMentionCSS(); this.updateMentionCSS();
@ -629,6 +650,23 @@ export default class ChatHook extends Module {
const t = this; const t = this;
this.CommunityChestBanner.ready(cls => {
const old_render = cls.prototype.render;
cls.prototype.render = function() {
try {
if ( ! t.chat.context.get('chat.community-chest.show') )
return null;
} catch(err) {
t.log.capture(err);
t.log.error(err);
}
return old_render.call(this);
};
this.CommunityChestBanner.forceUpdate();
});
this.InlineCallout.ready(cls => { this.InlineCallout.ready(cls => {
const old_render = cls.prototype.render; const old_render = cls.prototype.render;
cls.prototype.render = function() { cls.prototype.render = function() {
@ -637,6 +675,9 @@ export default class ChatHook extends Module {
if ( callout?.trackingType === 'community_points_reward' && ! t.chat.context.get('chat.points.show-callouts') ) if ( callout?.trackingType === 'community_points_reward' && ! t.chat.context.get('chat.points.show-callouts') )
return null; return null;
if ( callout?.trackingType === 'prime_gift_bomb' && ! t.chat.context.get('chat.community-chest.show') )
return null;
} catch(err) { } catch(err) {
t.log.capture(err); t.log.capture(err);
t.log.error(err); t.log.error(err);
@ -646,7 +687,7 @@ export default class ChatHook extends Module {
} }
this.InlineCallout.forceUpdate(); this.InlineCallout.forceUpdate();
}) });
this.CalloutSelector.ready(cls => { this.CalloutSelector.ready(cls => {
const old_render = cls.prototype.render; const old_render = cls.prototype.render;
@ -655,6 +696,9 @@ export default class ChatHook extends Module {
const callout = this.props.callouts[0] || this.props.pinnedCallout, const callout = this.props.callouts[0] || this.props.pinnedCallout,
ctype = callout?.event?.type; ctype = callout?.event?.type;
if ( ctype === 'prime-gift-bomb-gifter' && ! t.chat.context.get('chat.community-chest.show') )
return null;
if ( ctype === 'community-points-rewards' && ! t.chat.context.get('chat.points.show-callouts') ) if ( ctype === 'community-points-rewards' && ! t.chat.context.get('chat.points.show-callouts') )
return null; return null;
@ -1016,42 +1060,44 @@ export default class ChatHook extends Module {
return; return;
} else if ( msg.type === types.ModerationAction && inst.markUserEventDeleted && inst.unsetModeratedUser ) { } else if ( msg.type === types.ModerationAction && inst.markUserEventDeleted && inst.unsetModeratedUser ) {
//t.log.info('Moderation Action', msg); if ( !((! msg.level || ! msg.level.length) && msg.targetUserLogin && msg.targetUserLogin === inst.props.currentUserLogin) ) {
if ( ! inst.props.isCurrentUserModerator ) //t.log.info('Moderation Action', msg);
return; if ( ! inst.props.isCurrentUserModerator )
const mod_action = msg.moderationActionType;
if ( mod_action === 'ban' || mod_action === 'timeout' || mod_action === 'delete' ) {
const user = msg.targetUserLogin;
if ( inst.moderatedUsers.has(user) )
return; return;
const do_remove = t.chat.context.get('chat.filtering.remove-deleted') === 3; const mod_action = msg.moderationActionType;
if ( do_remove ) { if ( mod_action === 'ban' || mod_action === 'timeout' || mod_action === 'delete' ) {
const len = inst.buffer.length, const user = msg.targetUserLogin;
target_id = msg.messageID; if ( inst.moderatedUsers.has(user) )
inst.buffer = inst.buffer.filter(m => return;
m.type !== types.Message || ! m.user || m.user.userLogin !== user ||
(target_id && m.id !== target_id)
);
if ( len !== inst.buffer.length && ! inst.props.isBackground )
inst.notifySubscribers();
inst.ffzModerateBuffer([inst.delayedMessageBuffer], msg); const do_remove = t.chat.context.get('chat.filtering.remove-deleted') === 3;
if ( do_remove ) {
const len = inst.buffer.length,
target_id = msg.messageID;
inst.buffer = inst.buffer.filter(m =>
m.type !== types.Message || ! m.user || m.user.userLogin !== user ||
(target_id && m.id !== target_id)
);
if ( len !== inst.buffer.length && ! inst.props.isBackground )
inst.notifySubscribers();
} else inst.ffzModerateBuffer([inst.delayedMessageBuffer], msg);
inst.ffzModerateBuffer([inst.buffer, inst.delayedMessageBuffer], msg);
inst.moderatedUsers.add(user); } else
setTimeout(inst.unsetModeratedUser(user), 1e3); inst.ffzModerateBuffer([inst.buffer, inst.delayedMessageBuffer], msg);
inst.delayedMessageBuffer.push({ inst.moderatedUsers.add(user);
event: msg, setTimeout(inst.unsetModeratedUser(user), 1e3);
time: Date.now(),
shouldDelay: false
});
return; inst.delayedMessageBuffer.push({
event: msg,
time: Date.now(),
shouldDelay: false
});
return;
}
} }
} else if ( msg.type === types.Moderation && inst.markUserEventDeleted && inst.unsetModeratedUser ) { } else if ( msg.type === types.Moderation && inst.markUserEventDeleted && inst.unsetModeratedUser ) {