Skip to content

Commit

Permalink
Hide bits from community button
Browse files Browse the repository at this point in the history
Added ability to hide the bits on the community button
  • Loading branch information
Excellify committed Jun 19, 2024
1 parent 0338345 commit 0865e60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/site/twitch.tv/modules/chat/ChatModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ const chatEvents = useComponentHook<Twitch.ChatEventComponent>({
predicate: (n) => n.onClearChatEvent,
});
const hideBitsBalance = useConfig<boolean>("chat.hide_bits_balance");
useComponentHook<Twitch.ChatCommunityPointsButtonComponent>(
{
childSelector: ".community-points-summary",
predicate: (el) => el.shouldShowBitsBalance,
},
{
functionHooks: {
shouldShowBitsBalance(this, old) {
if (hideBitsBalance.value) return false;
return old.call(this);
},
},
},
);
const isHookable = ref(false);
const isHookableDbc = refDebounced(isHookable, 200);
Expand Down Expand Up @@ -484,5 +500,11 @@ export const config = [
hint: "Whether or not to display 7TV Badges",
defaultValue: true,
}),
declareConfig("chat.hide_bits_balance", "TOGGLE", {
label: "Hide Bits Balance",
hint: "Hide the bits balance in the chat.",
path: ["Chat", "Style"],
defaultValue: false,
}),
];
</script>
4 changes: 4 additions & 0 deletions src/types/twitch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ declare module Twitch {
determineGroup: (command: ChatCommand) => string;
};

export type ChatCommunityPointsButtonComponent = ReactExtended.WritableComponent<{}> & {
shouldShowBitsBalance: () => boolean;
};

export type ChatChannelPointsClaimComponent = ReactExtended.WritableComponent<{
hidden: boolean;
}> & {
Expand Down

0 comments on commit 0865e60

Please sign in to comment.