[Plugin] Super Reaction Tweaks (#1958)
Co-authored-by: V <vendicated@riseup.net> Co-authored-by: Jack Matthews <jm5112356@gmail.com>
This commit is contained in:
parent
5edc94062c
commit
9bd82943e3
11
src/plugins/superReactionTweaks/README.md
Normal file
11
src/plugins/superReactionTweaks/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Super Reaction Tweaks
|
||||
|
||||
This plugin applies configurable various tweaks to super reactions.
|
||||
|
||||
![Screenshot](https://user-images.githubusercontent.com/22851444/281598795-58f07116-9f95-4f64-940b-23a5499f2302.png)
|
||||
|
||||
## Features:
|
||||
|
||||
**Super React By Default** - The reaction picker will default to super reactions instead of normal reactions.
|
||||
|
||||
**Super Reaction Play Limit** - Allows you to decide how many super reaction animations can play at once, including removing the limit entirely.
|
63
src/plugins/superReactionTweaks/index.ts
Normal file
63
src/plugins/superReactionTweaks/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated, ant0n, FieryFlames and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
superReactByDefault: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Reaction picker will default to Super Reactions",
|
||||
default: true,
|
||||
},
|
||||
unlimitedSuperReactionPlaying: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Remove the limit on Super Reactions playing at once",
|
||||
default: false,
|
||||
},
|
||||
|
||||
superReactionPlayingLimit: {
|
||||
description: "Max Super Reactions to play at once",
|
||||
type: OptionType.SLIDER,
|
||||
default: 20,
|
||||
markers: [5, 10, 20, 40, 60, 80, 100],
|
||||
stickToMarkers: true,
|
||||
},
|
||||
}, {
|
||||
superReactionPlayingLimit: {
|
||||
disabled() { return this.store.unlimitedSuperReactionPlaying; },
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "SuperReactionTweaks",
|
||||
description: "Customize the limit of Super Reactions playing at once, and super react by default",
|
||||
authors: [Devs.FieryFlames, Devs.ant0n],
|
||||
patches: [
|
||||
{
|
||||
find: ",BURST_REACTION_EFFECT_PLAY",
|
||||
replacement: {
|
||||
match: /(?<=BURST_REACTION_EFFECT_PLAY:\i=>{.{50,100})(\i\(\i,\i\))>=\d+/,
|
||||
replace: "!$self.shouldPlayBurstReaction($1)"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".hasAvailableBurstCurrency)",
|
||||
replacement: {
|
||||
match: /(?<=\.useBurstReactionsExperiment.{0,20})useState\(!1\)(?=.+?(\i===\i\.EmojiIntention.REACTION))/,
|
||||
replace: "useState($self.settings.store.superReactByDefault && $1)"
|
||||
}
|
||||
}
|
||||
],
|
||||
settings,
|
||||
|
||||
shouldPlayBurstReaction(playingCount: number) {
|
||||
if (settings.store.unlimitedSuperReactionPlaying) return true;
|
||||
if (playingCount <= settings.store.superReactionPlayingLimit) return true;
|
||||
return false;
|
||||
}
|
||||
});
|
@ -379,6 +379,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||
name: "ProffDea",
|
||||
id: 609329952180928513n
|
||||
},
|
||||
ant0n: {
|
||||
name: "ant0n",
|
||||
id: 145224646868860928n
|
||||
},
|
||||
} satisfies Record<string, Dev>);
|
||||
|
||||
// iife so #__PURE__ works correctly
|
||||
|
Loading…
Reference in New Issue
Block a user