Plugin

SuperReactionTweaks

Customize the limit of Super Reactions playing at once, and super react by default

Reactions Emotes
index.ts
Download

Source

src/plugins/superReactionTweaks/index.ts
1import { definePluginSettings } from "@api/Settings";
2import { Devs } from "@utils/constants";
3import definePlugin, { OptionType } from "@utils/types";
4import { UserStore } from "@webpack/common";
5
6export const settings = definePluginSettings({
7 superReactByDefault: {
8 type: OptionType.BOOLEAN,
9 description: "Reaction picker will default to Super Reactions",
10 default: true,
11 },
12 unlimitedSuperReactionPlaying: {
13 type: OptionType.BOOLEAN,
14 description: "Remove the limit on Super Reactions playing at once",
15 default: false,
16 },
17
18 superReactionPlayingLimit: {
19 description: "Max Super Reactions to play at once. 0 to disable playing Super Reactions",
20 type: OptionType.SLIDER,
21 default: 20,
22 markers: [0, 5, 10, 20, 40, 60, 80, 100],
23 stickToMarkers: true,
24 },
25}, {
26 superReactionPlayingLimit: {
27 disabled() { return this.store.unlimitedSuperReactionPlaying; },
28 }
29});
30
31export default definePlugin({
32 name: "SuperReactionTweaks",
33 description: "Customize the limit of Super Reactions playing at once, and super react by default",
34 tags: ["Reactions", "Emotes"],
35 authors: [Devs.FieryFlames, Devs.ant0n],
36 patches: [
37 {
38 find: ",BURST_REACTION_EFFECT_PLAY",
39 replacement: [
40 {
41 // if (inlinedCalculatePlayingCount(a,b) >= limit) return;
42 match: /(BURST_REACTION_EFFECT_PLAY:\i=>{.+?if\()(\(\(\i,\i\)=>.+?\(\i,\i\))>=5+?(?=\))/,
43 replace: (_, rest, playingCount) => `${rest}!$self.shouldPlayBurstReaction(${playingCount})`
44 }
45 ]
46 },
47 {
48 find: ".EMOJI_PICKER_CONSTANTS_EMOJI_CONTAINER_PADDING_HORIZONTAL)",
49 replacement: {
50 match: /(openPopoutType:void 0(?=.+?isBurstReaction:(\i).+?;(\i===\i\.\i\.REACTION)&&\i\.push\().+?\[\2,\i\]=\i\.useState\()!1\)/,
51 replace: (_, rest, _isBurstReactionVariable, isReactionIntention) => `${rest}$self.shouldSuperReactByDefault&&${isReactionIntention})`
52 }
53 }
54 ],
55 settings,
56
57 shouldPlayBurstReaction(playingCount: number) {
58 if (settings.store.unlimitedSuperReactionPlaying) return true;
59 if (settings.store.superReactionPlayingLimit > playingCount) return true;
60 return false;
61 },
62
63 get shouldSuperReactByDefault() {
64 return settings.store.superReactByDefault && UserStore.getCurrentUser().premiumType != null;
65 }
66});
67