1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 01:56: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,6 +1060,7 @@ 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 ) {
if ( !((! msg.level || ! msg.level.length) && msg.targetUserLogin && msg.targetUserLogin === inst.props.currentUserLogin) ) {
//t.log.info('Moderation Action', msg); //t.log.info('Moderation Action', msg);
if ( ! inst.props.isCurrentUserModerator ) if ( ! inst.props.isCurrentUserModerator )
return; return;
@ -1053,6 +1098,7 @@ export default class ChatHook extends Module {
return; return;
} }
}
} else if ( msg.type === types.Moderation && inst.markUserEventDeleted && inst.unsetModeratedUser ) { } else if ( msg.type === types.Moderation && inst.markUserEventDeleted && inst.unsetModeratedUser ) {
//t.log.info('Moderation', msg); //t.log.info('Moderation', msg);