Skip to content

Commit 643bb89

Browse files
committed
Only Twitch Badges
1 parent acc4980 commit 643bb89

3 files changed

Lines changed: 40 additions & 9 deletions

File tree

app/src/lib/badgeParser.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,25 @@ import { getBadge } from "$lib/services/7TV/cosmetics";
44

55
import { badges } from "$stores/global";
66

7+
import { settings } from "$stores/settings";
8+
79
let BadgesData: Record<string, any> = get(badges);
810

911
badges.subscribe((e: any) => (BadgesData = e));
1012

13+
let onlyTwitchBadges = false;
14+
15+
settings.subscribe((cfg) => {
16+
const foundSetting = cfg.find(
17+
(setting) => setting.param == "badgesTTV",
18+
) || {
19+
value: false,
20+
};
21+
22+
if (typeof foundSetting.value == "boolean")
23+
onlyTwitchBadges = foundSetting.value;
24+
});
25+
1126
export function parseBadges(
1227
userstate: Record<string, any>,
1328
badgeData?: Record<string, any>,
@@ -108,6 +123,8 @@ export function parseBadges(
108123
}
109124
}
110125

126+
if (onlyTwitchBadges) return user_badges as parsedBadge[];
127+
111128
// OTHER BADGES
112129

113130
// CHATTERINO & CHATTERINO HOMIES

app/src/lib/chat.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ import { get, writable } from "svelte/store";
22
import { settings } from "$stores/settings";
33
import { execCommand } from "./chatCommands";
44

5-
const currentSettings = get(settings) || [];
6-
const modActions = (
7-
currentSettings.find((setting) => setting.param == "modAction") || {
5+
let modActions = false;
6+
let usernotices = false;
7+
8+
settings.subscribe((cfg) => {
9+
const foundSetting0 = cfg.find(
10+
(setting) => setting.param == "modAction",
11+
) || {
812
value: true,
9-
}
10-
).value;
11-
const usernotices = (
12-
currentSettings.find((setting) => setting.param == "redeem") || {
13+
};
14+
15+
const foundSetting1 = cfg.find((setting) => setting.param == "redeem") || {
1316
value: true,
14-
}
15-
).value;
17+
};
18+
19+
if (typeof foundSetting0.value == "boolean")
20+
modActions = foundSetting0.value;
21+
if (typeof foundSetting1.value == "boolean")
22+
usernotices = foundSetting1.value;
23+
});
1624

1725
interface ParsedMessage {
1826
raw: string;

app/src/stores/settings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ export const configs: Setting[] = [
112112
value: true,
113113
param: "badges",
114114
},
115+
{
116+
name: "Display only Twitch badges",
117+
type: "boolean",
118+
value: false,
119+
param: "badgesTTV",
120+
},
115121
{
116122
name: "Display channel points redeem, sub messages, annoucements... (Redeems & USERNOTICES)",
117123
type: "boolean",

0 commit comments

Comments
 (0)