Improvements for patches and misc stuff (#582)
This commit is contained in:
parent
7322c3af04
commit
40395d562a
@ -29,13 +29,12 @@ export default definePlugin({
|
|||||||
find: 'displayName="NoticeStore"',
|
find: 'displayName="NoticeStore"',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /;.{1,2}=null;.{0,70}getPremiumSubscription/g,
|
match: /(?=;\i=null;.{0,70}getPremiumSubscription)/g,
|
||||||
replace:
|
replace: ";if(Vencord.Api.Notices.currentNotice)return false"
|
||||||
";if(Vencord.Api.Notices.currentNotice)return false$&"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=,NOTICE_DISMISS:function\(\i\){)(?=if\(null==(\i)\))/,
|
match: /(?<=,NOTICE_DISMISS:function\(\i\){)(?=if\(null==(\i)\))/,
|
||||||
replace: 'if($1?.id=="VencordNotice")return($1=null,Vencord.Api.Notices.nextNotice(),true);'
|
replace: (_, notice) => `if(${notice}.id=="VencordNotice")return(${notice}=null,Vencord.Api.Notices.nextNotice(),true);`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ export default definePlugin({
|
|||||||
{
|
{
|
||||||
find: 'dispatch({type:"MODAL_POP_ALL"})',
|
find: 'dispatch({type:"MODAL_POP_ALL"})',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(?<popAll>\i)=function\(\){\(0,\i\.\i\)\(\);\i\.\i\.dispatch\({type:"MODAL_POP_ALL"}\).+};)/,
|
match: /"MODAL_POP_ALL".+?};(?<=(\i)=function.+?)/,
|
||||||
replace: "$self.popAllModals=$<popAll>;"
|
replace: (m, popAll) => `${m}$self.popAllModals=${popAll};`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -27,9 +27,9 @@ export default definePlugin({
|
|||||||
{
|
{
|
||||||
find: ".Messages.BOT_CALL_IDLE_DISCONNECT",
|
find: ".Messages.BOT_CALL_IDLE_DISCONNECT",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /function (?<functionName>.{1,3})\(\){.{1,100}\.Messages\.BOT_CALL_IDLE_DISCONNECT.+?}}/,
|
match: /(?<=function \i\(\){)(?=.{1,100}\.Messages\.BOT_CALL_IDLE_DISCONNECT)/,
|
||||||
replace: "function $<functionName>(){}",
|
replace: "return;"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Settings } from "@api/settings";
|
import { definePluginSettings } from "@api/settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
@ -24,49 +24,71 @@ import { Forms, React } from "@webpack/common";
|
|||||||
|
|
||||||
const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
|
const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
enableIsStaff: {
|
||||||
|
description: "Enable isStaff",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false,
|
||||||
|
restartNeeded: true
|
||||||
|
},
|
||||||
|
forceStagingBanner: {
|
||||||
|
description: "Whether to force Staging banner under user area.",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false,
|
||||||
|
restartNeeded: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "Experiments",
|
name: "Experiments",
|
||||||
|
description: "Enable Access to Experiments in Discord!",
|
||||||
authors: [
|
authors: [
|
||||||
Devs.Megu,
|
Devs.Megu,
|
||||||
Devs.Ven,
|
Devs.Ven,
|
||||||
Devs.Nickyux,
|
Devs.Nickyux,
|
||||||
Devs.BanTheNons
|
Devs.BanTheNons,
|
||||||
|
Devs.Nuckyz
|
||||||
],
|
],
|
||||||
description: "Enable Access to Experiments in Discord!",
|
settings,
|
||||||
patches: [{
|
|
||||||
find: "Object.defineProperties(this,{isDeveloper",
|
patches: [
|
||||||
replacement: {
|
{
|
||||||
match: /(?<={isDeveloper:\{[^}]+,get:function\(\)\{return )\w/,
|
find: "Object.defineProperties(this,{isDeveloper",
|
||||||
replace: "true"
|
replacement: {
|
||||||
|
match: /(?<={isDeveloper:\{[^}]+?,get:function\(\)\{return )\w/,
|
||||||
|
replace: "true"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, {
|
{
|
||||||
find: 'type:"user",revision',
|
find: 'type:"user",revision',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /!(\w{1,3})&&"CONNECTION_OPEN".+?;/g,
|
match: /!(\i)&&"CONNECTION_OPEN".+?;/g,
|
||||||
replace: "$1=!0;"
|
replace: "$1=!0;"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, {
|
{
|
||||||
find: ".isStaff=function(){",
|
find: ".isStaff=function(){",
|
||||||
predicate: () => Settings.plugins.Experiments.enableIsStaff === true,
|
predicate: () => settings.store.enableIsStaff,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /return\s*(\w+)\.hasFlag\((.+?)\.STAFF\)}/,
|
match: /return\s*?(\i)\.hasFlag\((\i\.\i)\.STAFF\)}/,
|
||||||
replace: "return Vencord.Webpack.Common.UserStore.getCurrentUser().id===$1.id||$1.hasFlag($2.STAFF)}"
|
replace: (_, user, flags) => `return Vencord.Webpack.Common.UserStore.getCurrentUser().id===${user}.id||${user}.hasFlag(${flags}.STAFF)}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /hasFreePremium=function\(\){return this.isStaff\(\)\s*\|\|/,
|
match: /hasFreePremium=function\(\){return this.isStaff\(\)\s*?\|\|/,
|
||||||
replace: "hasFreePremium=function(){return ",
|
replace: "hasFreePremium=function(){return ",
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}],
|
},
|
||||||
options: {
|
{
|
||||||
enableIsStaff: {
|
find: ".Messages.DEV_NOTICE_STAGING",
|
||||||
description: "Enable isStaff (requires restart)",
|
predicate: () => settings.store.forceStagingBanner,
|
||||||
type: OptionType.BOOLEAN,
|
replacement: {
|
||||||
default: false,
|
match: /"staging"===window\.GLOBAL_ENV\.RELEASE_CHANNEL/,
|
||||||
restartNeeded: true,
|
replace: "true"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
|
|
||||||
settingsAboutComponent: () => {
|
settingsAboutComponent: () => {
|
||||||
const isMacOS = navigator.platform.includes("Mac");
|
const isMacOS = navigator.platform.includes("Mac");
|
||||||
|
@ -72,7 +72,7 @@ migratePluginSettings("FakeNitro", "NitroBypass");
|
|||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "FakeNitro",
|
name: "FakeNitro",
|
||||||
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.obscurity, Devs.captain],
|
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.obscurity, Devs.captain, Devs.Nuckyz],
|
||||||
description: "Allows you to stream in nitro quality, send fake emojis/stickers and use client themes.",
|
description: "Allows you to stream in nitro quality, send fake emojis/stickers and use client themes.",
|
||||||
dependencies: ["MessageEventsAPI"],
|
dependencies: ["MessageEventsAPI"],
|
||||||
|
|
||||||
@ -82,16 +82,16 @@ export default definePlugin({
|
|||||||
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=(?<intention>\i)=\i\.intention)/,
|
match: /(?<=(\i)=\i\.intention)/,
|
||||||
replace: ",fakeNitroIntention=$<intention>"
|
replace: (_, intention) => `,fakeNitroIntention=${intention}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g,
|
match: /(?<=\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g,
|
||||||
replace: ',typeof fakeNitroIntention!=="undefined"?fakeNitroIntention:void 0'
|
replace: ',typeof fakeNitroIntention!=="undefined"?fakeNitroIntention:void 0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=&&!\i&&)!(?<canUseExternal>\i)(?=\)return \i\.\i\.DISALLOW_EXTERNAL;)/,
|
match: /(?<=&&!\i&&)!(\i)(?=\)return \i\.\i\.DISALLOW_EXTERNAL;)/,
|
||||||
replace: `(!$<canUseExternal>&&(typeof fakeNitroIntention==="undefined"||![${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)))`
|
replace: (_, canUseExternal) => `(!${canUseExternal}&&(typeof fakeNitroIntention==="undefined"||![${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)))`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -99,16 +99,16 @@ export default definePlugin({
|
|||||||
find: "canUseAnimatedEmojis:function",
|
find: "canUseAnimatedEmojis:function",
|
||||||
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\((?<user>\i))\){(?<premiumCheck>.+?\))/g,
|
match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\(\i)\){(.+?\))/g,
|
||||||
replace: `,fakeNitroIntention){$<premiumCheck>||fakeNitroIntention==null||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)`
|
replace: (_, premiumCheck) => `,fakeNitroIntention){${premiumCheck}||fakeNitroIntention==null||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "canUseStickersEverywhere:function",
|
find: "canUseStickersEverywhere:function",
|
||||||
predicate: () => Settings.plugins.FakeNitro.enableStickerBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableStickerBypass === true,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /canUseStickersEverywhere:function\(.+?\{/,
|
match: /(?<=canUseStickersEverywhere:function\(\i\){)/,
|
||||||
replace: "$&return true;"
|
replace: "return true;"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -128,8 +128,8 @@ export default definePlugin({
|
|||||||
"canStreamMidQuality"
|
"canStreamMidQuality"
|
||||||
].map(func => {
|
].map(func => {
|
||||||
return {
|
return {
|
||||||
match: new RegExp(`${func}:function\\(.+?\\{`),
|
match: new RegExp(`(?<=${func}:function\\(\\i\\){)`),
|
||||||
replace: "$&return true;"
|
replace: "return true;"
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
|||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { useForceUpdater } from "@utils/misc";
|
import { useForceUpdater } from "@utils/misc";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
||||||
import { Tooltip } from "webpack/common";
|
import { Tooltip } from "webpack/common";
|
||||||
|
|
||||||
enum ActivitiesTypes {
|
enum ActivitiesTypes {
|
||||||
@ -37,7 +37,7 @@ interface IgnoredActivity {
|
|||||||
const RegisteredGamesClasses = findByPropsLazy("overlayToggleIconOff", "overlayToggleIconOn");
|
const RegisteredGamesClasses = findByPropsLazy("overlayToggleIconOff", "overlayToggleIconOn");
|
||||||
const TryItOutClasses = findByPropsLazy("tryItOutBadge", "tryItOutBadgeIcon");
|
const TryItOutClasses = findByPropsLazy("tryItOutBadge", "tryItOutBadgeIcon");
|
||||||
const BaseShapeRoundClasses = findByPropsLazy("baseShapeRound", "baseShapeRoundLeft", "baseShapeRoundRight");
|
const BaseShapeRoundClasses = findByPropsLazy("baseShapeRound", "baseShapeRoundLeft", "baseShapeRoundRight");
|
||||||
const RunningGameStore = findByPropsLazy("getRunningGames", "getGamesSeen");
|
const RunningGameStore = findStoreLazy("RunningGameStore");
|
||||||
|
|
||||||
function ToggleIconOff() {
|
function ToggleIconOff() {
|
||||||
return (
|
return (
|
||||||
@ -71,7 +71,7 @@ function ToggleIconOff() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ToggleIconOn() {
|
function ToggleIconOn({ forceWhite }: { forceWhite?: boolean; }) {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
className={RegisteredGamesClasses.overlayToggleIconOn}
|
className={RegisteredGamesClasses.overlayToggleIconOn}
|
||||||
@ -80,14 +80,15 @@ function ToggleIconOn() {
|
|||||||
viewBox="0 0 32 26"
|
viewBox="0 0 32 26"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
className={RegisteredGamesClasses.fill}
|
className={forceWhite ? "" : RegisteredGamesClasses.fill}
|
||||||
|
fill={forceWhite ? "var(--white-500)" : ""}
|
||||||
d="M 16 8 C 7.664063 8 1.25 15.34375 1.25 15.34375 L 0.65625 16 L 1.25 16.65625 C 1.25 16.65625 7.097656 23.324219 14.875 23.9375 C 15.246094 23.984375 15.617188 24 16 24 C 16.382813 24 16.753906 23.984375 17.125 23.9375 C 24.902344 23.324219 30.75 16.65625 30.75 16.65625 L 31.34375 16 L 30.75 15.34375 C 30.75 15.34375 24.335938 8 16 8 Z M 16 10 C 18.203125 10 20.234375 10.601563 22 11.40625 C 22.636719 12.460938 23 13.675781 23 15 C 23 18.613281 20.289063 21.582031 16.78125 21.96875 C 16.761719 21.972656 16.738281 21.964844 16.71875 21.96875 C 16.480469 21.980469 16.242188 22 16 22 C 15.734375 22 15.476563 21.984375 15.21875 21.96875 C 11.710938 21.582031 9 18.613281 9 15 C 9 13.695313 9.351563 12.480469 9.96875 11.4375 L 9.9375 11.4375 C 11.71875 10.617188 13.773438 10 16 10 Z M 16 12 C 14.34375 12 13 13.34375 13 15 C 13 16.65625 14.34375 18 16 18 C 17.65625 18 19 16.65625 19 15 C 19 13.34375 17.65625 12 16 12 Z M 7.25 12.9375 C 7.09375 13.609375 7 14.285156 7 15 C 7 16.753906 7.5 18.394531 8.375 19.78125 C 5.855469 18.324219 4.105469 16.585938 3.53125 16 C 4.011719 15.507813 5.351563 14.203125 7.25 12.9375 Z M 24.75 12.9375 C 26.648438 14.203125 27.988281 15.507813 28.46875 16 C 27.894531 16.585938 26.144531 18.324219 23.625 19.78125 C 24.5 18.394531 25 16.753906 25 15 C 25 14.285156 24.90625 13.601563 24.75 12.9375 Z"
|
d="M 16 8 C 7.664063 8 1.25 15.34375 1.25 15.34375 L 0.65625 16 L 1.25 16.65625 C 1.25 16.65625 7.097656 23.324219 14.875 23.9375 C 15.246094 23.984375 15.617188 24 16 24 C 16.382813 24 16.753906 23.984375 17.125 23.9375 C 24.902344 23.324219 30.75 16.65625 30.75 16.65625 L 31.34375 16 L 30.75 15.34375 C 30.75 15.34375 24.335938 8 16 8 Z M 16 10 C 18.203125 10 20.234375 10.601563 22 11.40625 C 22.636719 12.460938 23 13.675781 23 15 C 23 18.613281 20.289063 21.582031 16.78125 21.96875 C 16.761719 21.972656 16.738281 21.964844 16.71875 21.96875 C 16.480469 21.980469 16.242188 22 16 22 C 15.734375 22 15.476563 21.984375 15.21875 21.96875 C 11.710938 21.582031 9 18.613281 9 15 C 9 13.695313 9.351563 12.480469 9.96875 11.4375 L 9.9375 11.4375 C 11.71875 10.617188 13.773438 10 16 10 Z M 16 12 C 14.34375 12 13 13.34375 13 15 C 13 16.65625 14.34375 18 16 18 C 17.65625 18 19 16.65625 19 15 C 19 13.34375 17.65625 12 16 12 Z M 7.25 12.9375 C 7.09375 13.609375 7 14.285156 7 15 C 7 16.753906 7.5 18.394531 8.375 19.78125 C 5.855469 18.324219 4.105469 16.585938 3.53125 16 C 4.011719 15.507813 5.351563 14.203125 7.25 12.9375 Z M 24.75 12.9375 C 26.648438 14.203125 27.988281 15.507813 28.46875 16 C 27.894531 16.585938 26.144531 18.324219 23.625 19.78125 C 24.5 18.394531 25 16.753906 25 15 C 25 14.285156 24.90625 13.601563 24.75 12.9375 Z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ToggleActivityComponent({ activity }: { activity: IgnoredActivity; }) {
|
function ToggleActivityComponent({ activity, forceWhite }: { activity: IgnoredActivity; forceWhite?: boolean; }) {
|
||||||
const forceUpdate = useForceUpdater();
|
const forceUpdate = useForceUpdater();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -105,7 +106,7 @@ function ToggleActivityComponent({ activity }: { activity: IgnoredActivity; }) {
|
|||||||
{
|
{
|
||||||
ignoredActivitiesCache.has(activity.id)
|
ignoredActivitiesCache.has(activity.id)
|
||||||
? <ToggleIconOff />
|
? <ToggleIconOff />
|
||||||
: <ToggleIconOn />
|
: <ToggleIconOn forceWhite={forceWhite} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -117,9 +118,9 @@ function ToggleActivityComponentWithBackground({ activity }: { activity: Ignored
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`${TryItOutClasses.tryItOutBadge} ${BaseShapeRoundClasses.baseShapeRound}`}
|
className={`${TryItOutClasses.tryItOutBadge} ${BaseShapeRoundClasses.baseShapeRound}`}
|
||||||
style={{ padding: "0 2px" }}
|
style={{ padding: "0px 2px" }}
|
||||||
>
|
>
|
||||||
<ToggleActivityComponent activity={activity} />
|
<ToggleActivityComponent activity={activity} forceWhite={true} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -142,28 +143,32 @@ export default definePlugin({
|
|||||||
name: "IgnoreActivities",
|
name: "IgnoreActivities",
|
||||||
authors: [Devs.Nuckyz],
|
authors: [Devs.Nuckyz],
|
||||||
description: "Ignore certain activities (like games and actual activities) from showing up on your status. You can configure which ones are ignored from the Registered Games and Activities tabs.",
|
description: "Ignore certain activities (like games and actual activities) from showing up on your status. You can configure which ones are ignored from the Registered Games and Activities tabs.",
|
||||||
patches: [{
|
patches: [
|
||||||
find: ".Messages.SETTINGS_GAMES_TOGGLE_OVERLAY",
|
{
|
||||||
replacement: {
|
find: ".Messages.SETTINGS_GAMES_TOGGLE_OVERLAY",
|
||||||
match: /!(\i)\|\|(null==\i\)return null;var \i=(\i)\.overlay.+?children:)(\[.{0,70}overlayStatusText.+?\])(?=}\)}\(\))/,
|
replacement: {
|
||||||
replace: (_, platformCheck, restWithoutPlatformCheck, props, children) => ""
|
match: /!(\i)\|\|(null==\i\)return null;var \i=(\i)\.overlay.+?children:)(\[.{0,70}overlayStatusText.+?\])(?=}\)}\(\))/,
|
||||||
+ `${restWithoutPlatformCheck}`
|
replace: (_, platformCheck, restWithoutPlatformCheck, props, children) => ""
|
||||||
+ `(${platformCheck}?${children}:[])`
|
+ `${restWithoutPlatformCheck}`
|
||||||
+ `.concat(Vencord.Plugins.plugins.IgnoreActivities.renderToggleGameActivityButton(${props}))`
|
+ `(${platformCheck}?${children}:[])`
|
||||||
|
+ `.concat(Vencord.Plugins.plugins.IgnoreActivities.renderToggleGameActivityButton(${props}))`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".overlayBadge",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=\(\)\.badgeContainer.+?(\i)\.name}\):null)/,
|
||||||
|
replace: (_, props) => `,$self.renderToggleActivityButton(${props})`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: '.displayName="LocalActivityStore"',
|
||||||
|
replacement: {
|
||||||
|
match: /LISTENING.+?\)\);(?<=(\i)\.push.+?)/,
|
||||||
|
replace: (m, activities) => `${m}${activities}=${activities}.filter($self.isActivityNotIgnored);`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, {
|
],
|
||||||
find: ".overlayBadge",
|
|
||||||
replacement: {
|
|
||||||
match: /.badgeContainer.+?.\?\(0,.\.jsx\)\(.{1,2},{name:(?<props>.)\.name}\):null/,
|
|
||||||
replace: "$&,$self.renderToggleActivityButton($<props>)"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
find: '.displayName="LocalActivityStore"',
|
|
||||||
replacement: {
|
|
||||||
match: /(?<activities>.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?\)\)/,
|
|
||||||
replace: "$&;$<activities>=$<activities>.filter($self.isActivityNotIgnored);"
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
const ignoredActivitiesData = await DataStore.get<string[] | Map<IgnoredActivity["id"], IgnoredActivity>>("IgnoreActivities_ignoredActivities") ?? new Map<IgnoredActivity["id"], IgnoredActivity>();
|
const ignoredActivitiesData = await DataStore.get<string[] | Map<IgnoredActivity["id"], IgnoredActivity>>("IgnoreActivities_ignoredActivities") ?? new Map<IgnoredActivity["id"], IgnoredActivity>();
|
||||||
@ -217,5 +222,5 @@ export default definePlugin({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Settings } from "@api/settings";
|
import { definePluginSettings } from "@api/settings";
|
||||||
import { makeRange } from "@components/PluginSettings/components/SettingSliderComponent";
|
import { makeRange } from "@components/PluginSettings/components/SettingSliderComponent";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { sleep } from "@utils/misc";
|
import { sleep } from "@utils/misc";
|
||||||
@ -54,15 +54,36 @@ const MOYAI = "🗿";
|
|||||||
const MOYAI_URL =
|
const MOYAI_URL =
|
||||||
"https://raw.githubusercontent.com/MeguminSama/VencordPlugins/main/plugins/moyai/moyai.mp3";
|
"https://raw.githubusercontent.com/MeguminSama/VencordPlugins/main/plugins/moyai/moyai.mp3";
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
volume: {
|
||||||
|
description: "Volume of the 🗿🗿🗿",
|
||||||
|
type: OptionType.SLIDER,
|
||||||
|
markers: makeRange(0, 1, 0.1),
|
||||||
|
default: 0.5,
|
||||||
|
stickToMarkers: false
|
||||||
|
},
|
||||||
|
triggerWhenUnfocused: {
|
||||||
|
description: "Trigger the 🗿 even when the window is unfocused",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
ignoreBots: {
|
||||||
|
description: "Ignore bots",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "Moyai",
|
name: "Moyai",
|
||||||
authors: [Devs.Megu, Devs.Nuckyz],
|
authors: [Devs.Megu, Devs.Nuckyz],
|
||||||
description: "🗿🗿🗿🗿🗿🗿🗿🗿",
|
description: "🗿🗿🗿🗿🗿🗿🗿🗿",
|
||||||
|
settings,
|
||||||
|
|
||||||
async onMessage(e: IMessageCreate) {
|
async onMessage(e: IMessageCreate) {
|
||||||
if (e.optimistic || e.type !== "MESSAGE_CREATE") return;
|
if (e.optimistic || e.type !== "MESSAGE_CREATE") return;
|
||||||
if (e.message.state === "SENDING") return;
|
if (e.message.state === "SENDING") return;
|
||||||
if (Settings.plugins.Moyai.ignoreBots && e.message.author?.bot) return;
|
if (settings.store.ignoreBots && e.message.author?.bot) return;
|
||||||
if (!e.message.content) return;
|
if (!e.message.content) return;
|
||||||
if (e.channelId !== SelectedChannelStore.getChannelId()) return;
|
if (e.channelId !== SelectedChannelStore.getChannelId()) return;
|
||||||
|
|
||||||
@ -76,7 +97,7 @@ export default definePlugin({
|
|||||||
|
|
||||||
onReaction(e: IReactionAdd) {
|
onReaction(e: IReactionAdd) {
|
||||||
if (e.optimistic || e.type !== "MESSAGE_REACTION_ADD") return;
|
if (e.optimistic || e.type !== "MESSAGE_REACTION_ADD") return;
|
||||||
if (Settings.plugins.Moyai.ignoreBots && UserStore.getUser(e.userId)?.bot) return;
|
if (settings.store.ignoreBots && UserStore.getUser(e.userId)?.bot) return;
|
||||||
if (e.channelId !== SelectedChannelStore.getChannelId()) return;
|
if (e.channelId !== SelectedChannelStore.getChannelId()) return;
|
||||||
|
|
||||||
const name = e.emoji.name.toLowerCase();
|
const name = e.emoji.name.toLowerCase();
|
||||||
@ -103,28 +124,6 @@ export default definePlugin({
|
|||||||
FluxDispatcher.unsubscribe("MESSAGE_CREATE", this.onMessage);
|
FluxDispatcher.unsubscribe("MESSAGE_CREATE", this.onMessage);
|
||||||
FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD", this.onReaction);
|
FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD", this.onReaction);
|
||||||
FluxDispatcher.unsubscribe("VOICE_CHANNEL_EFFECT_SEND", this.onVoiceChannelEffect);
|
FluxDispatcher.unsubscribe("VOICE_CHANNEL_EFFECT_SEND", this.onVoiceChannelEffect);
|
||||||
},
|
|
||||||
|
|
||||||
options: {
|
|
||||||
volume: {
|
|
||||||
description: "Volume of the 🗿🗿🗿",
|
|
||||||
type: OptionType.SLIDER,
|
|
||||||
markers: makeRange(0, 1, 0.1),
|
|
||||||
default: 0.5,
|
|
||||||
stickToMarkers: false,
|
|
||||||
},
|
|
||||||
triggerWhenUnfocused: {
|
|
||||||
description: "Trigger the 🗿 even when the window is unfocused",
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
default: true,
|
|
||||||
restartNeeded: false,
|
|
||||||
},
|
|
||||||
ignoreBots: {
|
|
||||||
description: "Ignore bots",
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
default: true,
|
|
||||||
restartNeeded: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -158,9 +157,9 @@ function getMoyaiCount(message: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function boom() {
|
function boom() {
|
||||||
if (!Settings.plugins.Moyai.triggerWhenUnfocused && !document.hasFocus()) return;
|
if (!settings.store.triggerWhenUnfocused && !document.hasFocus()) return;
|
||||||
const audioElement = document.createElement("audio");
|
const audioElement = document.createElement("audio");
|
||||||
audioElement.src = MOYAI_URL;
|
audioElement.src = MOYAI_URL;
|
||||||
audioElement.volume = Settings.plugins.Moyai.volume;
|
audioElement.volume = settings.store.volume;
|
||||||
audioElement.play();
|
audioElement.play();
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ export default definePlugin({
|
|||||||
"\\i\\.default\\.makeChunkedRequest\\(",
|
"\\i\\.default\\.makeChunkedRequest\\(",
|
||||||
"\\i\\.\\i\\.post\\({url:"
|
"\\i\\.\\i\\.post\\({url:"
|
||||||
].map(match => ({
|
].map(match => ({
|
||||||
match: new RegExp(`return\\[(?<code>\\d),${match}\\i\\.\\i\\.STREAM_PREVIEW.+?}\\)\\];`),
|
match: new RegExp(`(?=return\\[(\\d),${match}\\i\\.\\i\\.STREAM_PREVIEW.+?}\\)\\];)`),
|
||||||
replace: 'return[$<code>,Promise.resolve({body:"",status:204})];'
|
replace: (_, code) => `return[${code},Promise.resolve({body:"",status:204})];`
|
||||||
}))
|
}))
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
|
@ -41,7 +41,7 @@ export default definePlugin({
|
|||||||
replace: "[$1, $self.PronounsChatComponent(e)]"
|
replace: "[$1, $self.PronounsChatComponent(e)]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Hijack the discord pronouns section (hidden without experiment) and add a wrapper around the text section
|
// Hijack the discord pronouns section and add a wrapper around the text section
|
||||||
{
|
{
|
||||||
find: ".Messages.BOT_PROFILE_SLASH_COMMANDS",
|
find: ".Messages.BOT_PROFILE_SLASH_COMMANDS",
|
||||||
replacement: {
|
replacement: {
|
||||||
@ -49,12 +49,12 @@ export default definePlugin({
|
|||||||
replace: "$<fullProps>&&$self.PronounsProfileWrapper($<PronounComponent>,$<pronounProps>,$<fullProps>)"
|
replace: "$<fullProps>&&$self.PronounsProfileWrapper($<PronounComponent>,$<pronounProps>,$<fullProps>)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Make pronouns experiment be enabled by default
|
// Force enable pronouns component ignoring the experiment value
|
||||||
{
|
{
|
||||||
find: "2022-01_pronouns",
|
find: ".Messages.USER_POPOUT_PRONOUNS",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: "!1", // false
|
match: /\i\.\i\.useExperiment\({}\)\.showPronouns/,
|
||||||
replace: "!0"
|
replace: "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -32,8 +32,8 @@ export default definePlugin({
|
|||||||
{
|
{
|
||||||
find: ".removeObscurity=function",
|
find: ".removeObscurity=function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.removeObscurity=function\((\i)\){/,
|
match: /(?<=\.removeObscurity=function\((\i)\){)/,
|
||||||
replace: ".removeObscurity=function($1){$self.reveal($1);"
|
replace: (_, event) => `$self.reveal(${event});`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -64,29 +64,29 @@ export default definePlugin({
|
|||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
// RenderLevel defines if a channel is hidden, collapsed in category, visible, etc
|
// RenderLevel defines if a channel is hidden, collapsed in category, visible, etc
|
||||||
find: ".CannotShow",
|
find: ".CannotShow=",
|
||||||
// These replacements only change the necessary CannotShow's
|
// These replacements only change the necessary CannotShow's
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=isChannelGatedAndVisible\(this\.record\.guild_id,this\.record\.id\).+?renderLevel:)(?<RenderLevels>\i)\..+?(?=,)/,
|
match: /(?<=isChannelGatedAndVisible\(this\.record\.guild_id,this\.record\.id\).+?renderLevel:)(\i)\..+?(?=,)/,
|
||||||
replace: "this.category.isCollapsed?$<RenderLevels>.WouldShowIfUncollapsed:$<RenderLevels>.Show"
|
replace: (_, RenderLevels) => `this.category.isCollapsed?${RenderLevels}.WouldShowIfUncollapsed:${RenderLevels}.Show`
|
||||||
},
|
},
|
||||||
// Move isChannelGatedAndVisible renderLevel logic to the bottom to not show hidden channels in case they are muted
|
// Move isChannelGatedAndVisible renderLevel logic to the bottom to not show hidden channels in case they are muted
|
||||||
{
|
{
|
||||||
match: /(?<=(?<permissionCheck>if\(!\i\.\i\.can\(\i\.\i\.VIEW_CHANNEL.+?{)if\(this\.id===\i\).+?};)(?<isChannelGatedAndVisibleCondition>if\(!\i\.\i\.isChannelGatedAndVisible\(.+?})(?<restOfFunction>.+?)(?=return{renderLevel:\i\.Show.{1,40}return \i)/,
|
match: /(?<=(if\(!\i\.\i\.can\(\i\.\i\.VIEW_CHANNEL.+?{)if\(this\.id===\i\).+?};)(if\(!\i\.\i\.isChannelGatedAndVisible\(.+?})(.+?)(?=return{renderLevel:\i\.Show.{0,40}?return \i)/,
|
||||||
replace: "$<restOfFunction>$<permissionCheck>$<isChannelGatedAndVisibleCondition>}"
|
replace: (_, permissionCheck, isChannelGatedAndVisibleCondition, rest) => `${rest}${permissionCheck}${isChannelGatedAndVisibleCondition}}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=renderLevel:(?<renderLevelExpression>\i\(this,\i\)\?\i\.Show:\i\.WouldShowIfUncollapsed).+?renderLevel:).+?(?=,)/,
|
match: /(?<=renderLevel:(\i\(this,\i\)\?\i\.Show:\i\.WouldShowIfUncollapsed).+?renderLevel:).+?(?=,)/,
|
||||||
replace: "$<renderLevelExpression>"
|
replace: (_, renderLevelExpression) => renderLevelExpression
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=activeJoinedRelevantThreads.+?renderLevel:.+?,threadIds:\i\(this.record.+?renderLevel:)(?<RenderLevels>\i)\..+?(?=,)/,
|
match: /(?<=activeJoinedRelevantThreads.+?renderLevel:.+?,threadIds:\i\(this.record.+?renderLevel:)(\i)\..+?(?=,)/,
|
||||||
replace: "$<RenderLevels>.Show"
|
replace: (_, RenderLevels) => `${RenderLevels}.Show`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=getRenderLevel=function.+?return ).+?\?(?<renderLevelExpressionWithoutPermCheck>.+?):\i\.CannotShow(?=})/,
|
match: /(?<=getRenderLevel=function.+?return ).+?\?(.+?):\i\.CannotShow(?=})/,
|
||||||
replace: "$<renderLevelExpressionWithoutPermCheck>"
|
replace: (_, renderLevelExpressionWithoutPermCheck) => renderLevelExpressionWithoutPermCheck
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -95,18 +95,18 @@ export default definePlugin({
|
|||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Do not show confirmation to join a voice channel when already connected to another if clicking on a hidden voice channel
|
// Do not show confirmation to join a voice channel when already connected to another if clicking on a hidden voice channel
|
||||||
match: /(?<=getCurrentClientVoiceChannelId\(\i\.guild_id\);if\()(?=.+?\((?<channel>\i)\))/,
|
match: /(?<=getCurrentClientVoiceChannelId\((\i)\.guild_id\);if\()/,
|
||||||
replace: "!$self.isHiddenChannel($<channel>)&&"
|
replace: (_, channel) => `!$self.isHiddenChannel(${channel})&&`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Make Discord think we are connected to a voice channel so it shows us inside it
|
// Make Discord think we are connected to a voice channel so it shows us inside it
|
||||||
match: /(?=\|\|\i\.default\.selectVoiceChannel\((?<channel>\i)\.id\))/,
|
match: /(?=\|\|\i\.default\.selectVoiceChannel\((\i)\.id\))/,
|
||||||
replace: "||$self.isHiddenChannel($<channel>)"
|
replace: (_, channel) => `||$self.isHiddenChannel(${channel})`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Make Discord think we are connected to a voice channel so it shows us inside it
|
// Make Discord think we are connected to a voice channel so it shows us inside it
|
||||||
match: /(?<=\|\|\i\.default\.selectVoiceChannel\((?<channel>\i)\.id\);!__OVERLAY__&&\()/,
|
match: /(?<=\|\|\i\.default\.selectVoiceChannel\((\i)\.id\);!__OVERLAY__&&\()/,
|
||||||
replace: "$self.isHiddenChannel($<channel>)||"
|
replace: (_, channel) => `$self.isHiddenChannel(${channel})||`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -119,7 +119,7 @@ export default definePlugin({
|
|||||||
"renderInviteButton",
|
"renderInviteButton",
|
||||||
"renderOpenChatButton"
|
"renderOpenChatButton"
|
||||||
].map(func => ({
|
].map(func => ({
|
||||||
match: new RegExp(`(?<=\\i\\.${func}=function\\(\\){)`, "g"), // Global because Discord has multiple declarations of the same functions
|
match: new RegExp(`(?<=${func}=function\\(\\){)`, "g"), // Global because Discord has multiple declarations of the same functions
|
||||||
replace: "if($self.isHiddenChannel(this.props.channel))return null;"
|
replace: "if($self.isHiddenChannel(this.props.channel))return null;"
|
||||||
}))
|
}))
|
||||||
]
|
]
|
||||||
@ -129,17 +129,8 @@ export default definePlugin({
|
|||||||
predicate: () => settings.store.showMode === ShowMode.LockIcon,
|
predicate: () => settings.store.showMode === ShowMode.LockIcon,
|
||||||
replacement: {
|
replacement: {
|
||||||
// Lock Icon
|
// Lock Icon
|
||||||
match: /(?=switch\((?<channel>\i)\.type\).{1,30}\.GUILD_ANNOUNCEMENT.{1,30}\(0,\i\.\i\))/,
|
match: /(?=switch\((\i)\.type\).{0,30}\.GUILD_ANNOUNCEMENT.{0,30}\(0,\i\.\i\))/,
|
||||||
replace: "if($self.isHiddenChannel($<channel>))return $self.LockIcon;"
|
replace: (_, channel) => `if($self.isHiddenChannel(${channel}))return $self.LockIcon;`
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: ".UNREAD_HIGHLIGHT",
|
|
||||||
predicate: () => settings.store.hideUnreads === true,
|
|
||||||
replacement: {
|
|
||||||
// Hide unreads
|
|
||||||
match: /(?<=\i\.connected,\i=)(?=(?<props>\i)\.unread)/,
|
|
||||||
replace: "$self.isHiddenChannel($<props>.channel)?false:"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -148,36 +139,44 @@ export default definePlugin({
|
|||||||
replacement: [
|
replacement: [
|
||||||
// Make the channel appear as muted if it's hidden
|
// Make the channel appear as muted if it's hidden
|
||||||
{
|
{
|
||||||
match: /(?<=\i\.name,\i=)(?=(?<props>\i)\.muted)/,
|
match: /(?<=\i\.name,\i=)(?=(\i)\.muted)/,
|
||||||
replace: "$self.isHiddenChannel($<props>.channel)?true:"
|
replace: (_, props) => `$self.isHiddenChannel(${props}.channel)?true:`
|
||||||
},
|
},
|
||||||
// Add the hidden eye icon if the channel is hidden
|
// Add the hidden eye icon if the channel is hidden
|
||||||
{
|
{
|
||||||
match: /(?<=(?<channel>\i)=\i\.channel,.+?\(\)\.children.+?:null)/,
|
match: /\(\).children.+?:null(?<=(\i)=\i\.channel,.+?)/,
|
||||||
replace: ",$self.isHiddenChannel($<channel>)?$self.HiddenChannelIcon():null"
|
replace: (m, channel) => `${m},$self.isHiddenChannel(${channel})?$self.HiddenChannelIcon():null`
|
||||||
},
|
},
|
||||||
// Make voice channels also appear as muted if they are muted
|
// Make voice channels also appear as muted if they are muted
|
||||||
{
|
{
|
||||||
match: /(?<=\i\(\)\.wrapper:\i\(\)\.notInteractive,)(?<otherClasses>.+?)(?<mutedClassExpression>(?<isMuted>\i)\?\i\.MUTED)/,
|
match: /(?<=\.wrapper:\i\(\)\.notInteractive,)(.+?)((\i)\?\i\.MUTED)/,
|
||||||
replace: "$<mutedClassExpression>:\"\",$<otherClasses>$<isMuted>?\"\""
|
replace: (_, otherClasses, mutedClassExpression, isMuted) => `${mutedClassExpression}:"",${otherClasses}${isMuted}?""`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
// Make muted channels also appear as unread if hide unreads is false, using the HiddenIconWithMutedStyle and the channel is hidden
|
|
||||||
{
|
{
|
||||||
find: ".UNREAD_HIGHLIGHT",
|
find: ".UNREAD_HIGHLIGHT",
|
||||||
predicate: () => settings.store.hideUnreads === false && settings.store.showMode === ShowMode.HiddenIconWithMutedStyle,
|
replacement: [
|
||||||
replacement: {
|
{
|
||||||
match: /(?<=(?<channel>\i)=\i\.channel,.+?\.LOCKED:\i)/,
|
// Make muted channels also appear as unread if hide unreads is false, using the HiddenIconWithMutedStyle and the channel is hidden
|
||||||
replace: "&&!($self.settings.store.hideUnreads===false&&$self.isHiddenChannel($<channel>))"
|
predicate: () => settings.store.hideUnreads === false && settings.store.showMode === ShowMode.HiddenIconWithMutedStyle,
|
||||||
}
|
match: /\.LOCKED:\i(?<=(\i)=\i\.channel,.+?)/,
|
||||||
|
replace: (m, channel) => `${m}&&!$self.isHiddenChannel(${channel})`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Hide unreads
|
||||||
|
predicate: () => settings.store.hideUnreads === true,
|
||||||
|
match: /(?<=\i\.connected,\i=)(?=(\i)\.unread)/,
|
||||||
|
replace: (_, props) => `$self.isHiddenChannel(${props}.channel)?false:`
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Hide New unreads box for hidden channels
|
// Hide New unreads box for hidden channels
|
||||||
find: '.displayName="ChannelListUnreadsStore"',
|
find: '.displayName="ChannelListUnreadsStore"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=return null!=(?<channel>\i))(?=.{1,130}hasRelevantUnread\(\i\))/g, // Global because Discord has multiple methods like that in the same module
|
match: /(?<=return null!=(\i))(?=.{0,130}?hasRelevantUnread\(\i\))/g, // Global because Discord has multiple methods like that in the same module
|
||||||
replace: "&&!$self.isHiddenChannel($<channel>)"
|
replace: (_, channel) => `&&!$self.isHiddenChannel(${channel})`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Only render the channel header and buttons that work when transitioning to a hidden channel
|
// Only render the channel header and buttons that work when transitioning to a hidden channel
|
||||||
@ -185,20 +184,20 @@ export default definePlugin({
|
|||||||
find: "Missing channel in Channel.renderHeaderToolbar",
|
find: "Missing channel in Channel.renderHeaderToolbar",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=renderHeaderToolbar=function.+?case \i\.\i\.GUILD_TEXT:)(?=.+?;(?<pushNotificationButtonExpression>.+?{channel:(?<channel>\i)},"notifications"\)\);))/,
|
match: /(?<=renderHeaderToolbar=function.+?case \i\.\i\.GUILD_TEXT:)(?=.+?;(.+?{channel:(\i)},"notifications"\)\);))/,
|
||||||
replace: "if($self.isHiddenChannel($<channel>)){$<pushNotificationButtonExpression>break;}"
|
replace: (_, pushNotificationButtonExpression, channel) => `if($self.isHiddenChannel(${channel})){${pushNotificationButtonExpression}break;}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=renderHeaderToolbar=function.+?case \i\.\i\.GUILD_FORUM:if\(!\i\){)(?=.+?;(?<pushNotificationButtonExpression>.+?{channel:(?<channel>\i)},"notifications"\)\)))/,
|
match: /(?<=renderHeaderToolbar=function.+?case \i\.\i\.GUILD_FORUM:if\(!\i\){)(?=.+?;(.+?{channel:(\i)},"notifications"\)\)))/,
|
||||||
replace: "if($self.isHiddenChannel($<channel>)){$<pushNotificationButtonExpression>;break;}"
|
replace: (_, pushNotificationButtonExpression, channel) => `if($self.isHiddenChannel(${channel})){${pushNotificationButtonExpression};break;}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=(?<this>\i)\.renderMobileToolbar=function.+?case \i\.\i\.GUILD_FORUM:)/,
|
match: /renderMobileToolbar=function.+?case \i\.\i\.GUILD_FORUM:(?<=(\i)\.renderMobileToolbar.+?)/,
|
||||||
replace: "if($self.isHiddenChannel($<this>.props.channel))break;"
|
replace: (m, that) => `${m}if($self.isHiddenChannel(${that}.props.channel))break;`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=renderHeaderBar=function.+?hideSearch:(?<channel>\i)\.isDirectory\(\))/,
|
match: /(?<=renderHeaderBar=function.+?hideSearch:(\i)\.isDirectory\(\))/,
|
||||||
replace: "||$self.isHiddenChannel($<channel>)"
|
replace: (_, channel) => `||$self.isHiddenChannel(${channel})`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=renderSidebar=function\(\){)/,
|
match: /(?<=renderSidebar=function\(\){)/,
|
||||||
@ -213,25 +212,23 @@ export default definePlugin({
|
|||||||
// Avoid trying to fetch messages from hidden channels
|
// Avoid trying to fetch messages from hidden channels
|
||||||
{
|
{
|
||||||
find: '"MessageManager"',
|
find: '"MessageManager"',
|
||||||
replacement: [
|
replacement: {
|
||||||
{
|
match: /"Skipping fetch because channelId is a static route"\);else{(?=.+?getChannel\((\i)\))/,
|
||||||
match: /(?<=if\(null!=(?<channelId>\i)\).{1,100}"Skipping fetch because channelId is a static route".{1,10}else{)/,
|
replace: (m, channelId) => `${m}if($self.isHiddenChannel({channelId:${channelId}}))return;`
|
||||||
replace: "if($self.isHiddenChannel({channelId:$<channelId>}))return;"
|
}
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
// Patch keybind handlers so you can't accidentally jump to hidden channels
|
// Patch keybind handlers so you can't accidentally jump to hidden channels
|
||||||
{
|
{
|
||||||
find: '"alt+shift+down"',
|
find: '"alt+shift+down"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=getChannel\(\i\);return null!=(?<channel>\i))(?=.{1,130}hasRelevantUnread\(\i\))/,
|
match: /(?<=getChannel\(\i\);return null!=(\i))(?=.{0,130}?hasRelevantUnread\(\i\))/,
|
||||||
replace: "&&!$self.isHiddenChannel($<channel>)"
|
replace: (_, channel) => `&&!$self.isHiddenChannel(${channel})`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: '"alt+down"',
|
find: '"alt+down"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=getState\(\)\.channelId.{1,30}\(0,\i\.\i\)\(\i\))(?=\.map\()/,
|
match: /(?<=getState\(\)\.channelId.{0,30}?\(0,\i\.\i\)\(\i\))(?=\.map\()/,
|
||||||
replace: ".filter(ch=>!$self.isHiddenChannel(ch))"
|
replace: ".filter(ch=>!$self.isHiddenChannel(ch))"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -239,8 +236,8 @@ export default definePlugin({
|
|||||||
{
|
{
|
||||||
find: 'jumboable?"jumbo":"default"',
|
find: 'jumboable?"jumbo":"default"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(?<component>\i)=function.{1,20}node,\i=\i.isInteracting.+?}}\)},)/,
|
match: /jumboable\?"jumbo":"default",emojiId.+?}}\)},(?<=(\i)=function\(\i\){var \i=\i\.node.+?)/,
|
||||||
replace: "shcEmojiComponentExport=($self.setEmojiComponent($<component>),void 0),"
|
replace: (m, component) => `${m}shcEmojiComponentExport=($self.setEmojiComponent(${component}),void 0),`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -248,13 +245,13 @@ export default definePlugin({
|
|||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Export the channel beggining header
|
// Export the channel beggining header
|
||||||
match: /(?<=function (?<component>\i)\(.{1,600}computePermissionsForRoles.+?}\)})(?=var)/,
|
match: /computePermissionsForRoles.+?}\)}(?<=function (\i)\(.+?)(?=var)/,
|
||||||
replace: "$self.setChannelBeginHeaderComponent($<component>);"
|
replace: (m, component) => `${m}$self.setChannelBeginHeaderComponent(${component});`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Patch the header to only return allowed users and roles if it's a hidden channel (Like when it's used on the HiddenChannelLockScreen)
|
// Patch the header to only return allowed users and roles if it's a hidden channel (Like when it's used on the HiddenChannelLockScreen)
|
||||||
match: /(?<=MANAGE_ROLES.{1,60}return)(?=\(.+?(?<component>\(0,\i\.jsxs\)\("div",{className:\i\(\)\.members.+?guildId:(?<channel>\i)\.guild_id.+?roleColor.+?]}\)))/,
|
match: /MANAGE_ROLES.{0,60}?return(?=\(.+?(\(0,\i\.jsxs\)\("div",{className:\i\(\)\.members.+?guildId:(\i)\.guild_id.+?roleColor.+?]}\)))/,
|
||||||
replace: " $self.isHiddenChannel($<channel>)?$<component>:"
|
replace: (m, component, channel) => `${m} $self.isHiddenChannel(${channel})?${component}:`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -263,23 +260,23 @@ export default definePlugin({
|
|||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Remove the divider and the open chat button for the HiddenChannelLockScreen
|
// Remove the divider and the open chat button for the HiddenChannelLockScreen
|
||||||
match: /(?<=function \i\((?<props>\i)\).{1,2000}"more-options-popout"\)\);if\()/,
|
match: /"more-options-popout"\)\);if\((?<=function \i\((\i)\).+?)/,
|
||||||
replace: "(!$self.isHiddenChannel($<props>.channel)||$<props>.inCall)&&"
|
replace: (m, props) => `${m}(!$self.isHiddenChannel(${props}.channel)||${props}.inCall)&&`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Render our HiddenChannelLockScreen component instead of the main voice channel component
|
// Render our HiddenChannelLockScreen component instead of the main voice channel component
|
||||||
match: /(?<=renderContent=function.{1,1700}children:)/,
|
match: /this\.renderVoiceChannelEffects.+?children:(?<=renderContent=function.+?)/,
|
||||||
replace: "!this.props.inCall&&$self.isHiddenChannel(this.props.channel)?$self.HiddenChannelLockScreen(this.props.channel):"
|
replace: "$&!this.props.inCall&&$self.isHiddenChannel(this.props.channel)?$self.HiddenChannelLockScreen(this.props.channel):"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Disable gradients for the HiddenChannelLockScreen of voice channels
|
// Disable gradients for the HiddenChannelLockScreen of voice channels
|
||||||
match: /(?<=renderContent=function.{1,1600}disableGradients:)/,
|
match: /this\.renderVoiceChannelEffects.+?disableGradients:(?<=renderContent=function.+?)/,
|
||||||
replace: "!this.props.inCall&&$self.isHiddenChannel(this.props.channel)||"
|
replace: "$&!this.props.inCall&&$self.isHiddenChannel(this.props.channel)||"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Disable useless components for the HiddenChannelLockScreen of voice channels
|
// Disable useless components for the HiddenChannelLockScreen of voice channels
|
||||||
match: /(?<=renderContent=function.{1,800}render(?!Header).{0,30}:)(?!void)/g,
|
match: /(?:{|,)render(?!Header|ExternalHeader).{0,30}?:(?<=renderContent=function.+?)(?!void)/g,
|
||||||
replace: "!this.props.inCall&&$self.isHiddenChannel(this.props.channel)?null:"
|
replace: "$&!this.props.inCall&&$self.isHiddenChannel(this.props.channel)?null:"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -288,40 +285,58 @@ export default definePlugin({
|
|||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Render our HiddenChannelLockScreen component instead of the main stage channel component
|
// Render our HiddenChannelLockScreen component instead of the main stage channel component
|
||||||
match: /(?<=(?<channel>\i)\.getGuildId\(\).{1,30}Guild voice channel without guild id\..{1,1400}children:)(?=.{1,20}}\)}function)/,
|
match: /Guild voice channel without guild id.+?children:(?<=(\i)\.getGuildId\(\).+?)(?=.{0,20}?}\)}function)/,
|
||||||
replace: "$self.isHiddenChannel($<channel>)?$self.HiddenChannelLockScreen($<channel>):"
|
replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?$self.HiddenChannelLockScreen(${channel}):`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Disable useless components for the HiddenChannelLockScreen of stage channels
|
// Disable useless components for the HiddenChannelLockScreen of stage channels
|
||||||
match: /(?<=(?<channel>\i)\.getGuildId\(\).{1,30}Guild voice channel without guild id\..{1,1000}render(?!Header).{0,30}:)/g,
|
match: /render(?!Header).{0,30}?:(?<=(\i)\.getGuildId\(\).+?Guild voice channel without guild id.+?)/g,
|
||||||
replace: "$self.isHiddenChannel($<channel>)?null:"
|
replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?null:`
|
||||||
},
|
},
|
||||||
// Prevent Discord from replacing our route if we aren't connected to the stage channel
|
// Prevent Discord from replacing our route if we aren't connected to the stage channel
|
||||||
{
|
{
|
||||||
match: /(?<=if\()(?=!\i&&!\i&&!\i.{1,80}(?<channel>\i)\.getGuildId\(\).{1,50}Guild voice channel without guild id\.)/,
|
match: /(?=!\i&&!\i&&!\i.{0,80}?(\i)\.getGuildId\(\).{0,50}?Guild voice channel without guild id)(?<=if\()/,
|
||||||
replace: "!$self.isHiddenChannel($<channel>)&&"
|
replace: (_, channel) => `!$self.isHiddenChannel(${channel})&&`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Disable gradients for the HiddenChannelLockScreen of stage channels
|
// Disable gradients for the HiddenChannelLockScreen of stage channels
|
||||||
match: /(?<=(?<channel>\i)\.getGuildId\(\).{1,30}Guild voice channel without guild id\..{1,600}disableGradients:)/,
|
match: /Guild voice channel without guild id.+?disableGradients:(?<=(\i)\.getGuildId\(\).+?)/,
|
||||||
replace: "$self.isHiddenChannel($<channel>)||"
|
replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})||`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Disable strange styles applied to the header for the HiddenChannelLockScreen of stage channels
|
// Disable strange styles applied to the header for the HiddenChannelLockScreen of stage channels
|
||||||
match: /(?<=(?<channel>\i)\.getGuildId\(\).{1,30}Guild voice channel without guild id\..{1,600}style:)/,
|
match: /Guild voice channel without guild id.+?style:(?<=(\i)\.getGuildId\(\).+?)/,
|
||||||
replace: "$self.isHiddenChannel($<channel>)?undefined:"
|
replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?undefined:`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Remove the divider and amount of users in stage channel components for the HiddenChannelLockScreen
|
// Remove the divider and amount of users in stage channel components for the HiddenChannelLockScreen
|
||||||
match: /\(0,\i\.jsx\)\(\i\.\i\.Divider.+?}\)]}\)(?=.+?:(?<channel>\i)\.guild_id)/,
|
match: /\(0,\i\.jsx\)\(\i\.\i\.Divider.+?}\)]}\)(?=.+?:(\i)\.guild_id)/,
|
||||||
replace: "$self.isHiddenChannel($<channel>)?null:($&)"
|
replace: (m, channel) => `$self.isHiddenChannel(${channel})?null:(${m})`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Remove the open chat button for the HiddenChannelLockScreen
|
// Remove the open chat button for the HiddenChannelLockScreen
|
||||||
match: /(?<=null,)(?=.{1,120}channelId:(?<channel>\i)\.id,.+?toggleRequestToSpeakSidebar:\i,iconClassName:\i\(\)\.buttonIcon)/,
|
match: /"recents".+?null,(?=.{0,120}?channelId:(\i)\.id)/,
|
||||||
replace: "!$self.isHiddenChannel($<channel>)&&"
|
replace: (m, channel) => `${m}!$self.isHiddenChannel(${channel})&&`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// The module wasn't being found, so lets just escape everything
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
|
find: "\^https\:\/\/\(\?\:canary\.\|ptb\.\)\?discord.com\/channels\/\(\\\\\d\+\|",
|
||||||
|
replacement: {
|
||||||
|
// Make mentions of hidden channels work
|
||||||
|
match: /\i\.\i\.can\(\i\.\i\.VIEW_CHANNEL,\i\)/,
|
||||||
|
replace: "true"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ".shouldCloseDefaultModals",
|
||||||
|
replacement: {
|
||||||
|
// Show inside voice channel instead of trying to join them when clicking on a channel mention
|
||||||
|
match: /(?<=getChannel\((\i)\)\)(?=.{0,100}?selectVoiceChannel))/,
|
||||||
|
replace: (_, channelId) => `&&!$self.isHiddenChannel({channelId:${channelId}})`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -16,53 +16,55 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { migratePluginSettings, Settings } from "@api/settings";
|
import { definePluginSettings, migratePluginSettings } from "@api/settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
noSpotifyAutoPause: {
|
||||||
|
description: "Disable Spotify auto-pause",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: true,
|
||||||
|
restartNeeded: true
|
||||||
|
},
|
||||||
|
keepSpotifyActivityOnIdle: {
|
||||||
|
description: "Keep Spotify activity playing when idling",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false,
|
||||||
|
restartNeeded: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
migratePluginSettings("SpotifyCrack", "Ify");
|
migratePluginSettings("SpotifyCrack", "Ify");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "SpotifyCrack",
|
name: "SpotifyCrack",
|
||||||
description: "Free listen along, no auto-pausing in voice chat, and allows activity to continue playing when idling",
|
description: "Free listen along, no auto-pausing in voice chat, and allows activity to continue playing when idling",
|
||||||
authors: [
|
authors: [Devs.Cyn, Devs.Nuckyz],
|
||||||
Devs.Cyn,
|
settings,
|
||||||
Devs.Nuckyz
|
|
||||||
],
|
|
||||||
|
|
||||||
patches: [{
|
patches: [
|
||||||
find: 'dispatch({type:"SPOTIFY_PROFILE_UPDATE"',
|
{
|
||||||
replacement: [{
|
|
||||||
match: /(function\((.{1,2})\){)(.{1,6}dispatch\({type:"SPOTIFY_PROFILE_UPDATE")/,
|
|
||||||
replace: (_, functionStart, data, functionBody) => `${functionStart}${data}.body.product="premium";${functionBody}`
|
|
||||||
}],
|
|
||||||
}, {
|
|
||||||
find: '.displayName="SpotifyStore"',
|
|
||||||
predicate: () => Settings.plugins.SpotifyCrack.noSpotifyAutoPause,
|
|
||||||
replacement: {
|
|
||||||
match: /function (.{1,2})\(\).{0,200}SPOTIFY_AUTO_PAUSED\);.{0,}}}}/,
|
|
||||||
replace: "function $1(){}"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
find: '.displayName="SpotifyStore"',
|
|
||||||
predicate: () => Settings.plugins.SpotifyCrack.keepSpotifyActivityOnIdle,
|
|
||||||
replacement: {
|
|
||||||
match: /(shouldShowActivity=function\(\){.{1,50})&&!.{1,6}\.isIdle\(\)(.{0,}?})/,
|
|
||||||
replace: (_, functionDeclarationAndExpression, restOfFunction) => `${functionDeclarationAndExpression}${restOfFunction}`
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
|
|
||||||
options: {
|
find: 'dispatch({type:"SPOTIFY_PROFILE_UPDATE"',
|
||||||
noSpotifyAutoPause: {
|
replacement: {
|
||||||
description: "Disable Spotify auto-pause",
|
match: /SPOTIFY_PROFILE_UPDATE.+?isPremium:(?="premium"===(\i)\.body\.product)/,
|
||||||
type: OptionType.BOOLEAN,
|
replace: (m, req) => `${m}(${req}.body.product="premium")&&`
|
||||||
default: true,
|
},
|
||||||
restartNeeded: true,
|
|
||||||
},
|
},
|
||||||
keepSpotifyActivityOnIdle: {
|
{
|
||||||
description: "Keep Spotify activity playing when idling",
|
find: '.displayName="SpotifyStore"',
|
||||||
type: OptionType.BOOLEAN,
|
replacement: [
|
||||||
default: false,
|
{
|
||||||
restartNeeded: true,
|
predicate: () => settings.store.noSpotifyAutoPause,
|
||||||
|
match: /(?<=function \i\(\){)(?=.{0,200}SPOTIFY_AUTO_PAUSED\))/,
|
||||||
|
replace: "return;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
predicate: () => settings.store.keepSpotifyActivityOnIdle,
|
||||||
|
match: /(?<=shouldShowActivity=function\(\){.{0,50})&&!\i\.\i\.isIdle\(\)/,
|
||||||
|
replace: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
});
|
});
|
||||||
|
@ -121,8 +121,8 @@ export default definePlugin({
|
|||||||
{
|
{
|
||||||
find: ".UNREAD_HIGHLIGHT",
|
find: ".UNREAD_HIGHLIGHT",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(?<channel>\i)=\i\.channel,.+?\(\)\.children.+?:null)/,
|
match: /\(\).children.+?:null(?<=(\i)=\i\.channel,.+?)/,
|
||||||
replace: ",$self.TypingIndicator($<channel>.id)"
|
replace: (m, channel) => `${m},$self.TypingIndicator(${channel}.id)`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -16,14 +16,26 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { makeRange } from "@components/PluginSettings/components/SettingSliderComponent";
|
import { definePluginSettings } from "@api/settings";
|
||||||
|
import { makeRange } from "@components/PluginSettings/components";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
multiplier: {
|
||||||
|
description: "Volume Multiplier",
|
||||||
|
type: OptionType.SLIDER,
|
||||||
|
markers: makeRange(1, 5, 1),
|
||||||
|
default: 2,
|
||||||
|
stickToMarkers: true,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "VolumeBooster",
|
name: "VolumeBooster",
|
||||||
authors: [Devs.Nuckyz],
|
authors: [Devs.Nuckyz],
|
||||||
description: "Allows you to set the user and stream volume above the default maximum.",
|
description: "Allows you to set the user and stream volume above the default maximum.",
|
||||||
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
// Change the max volume for sliders to allow for values above 200
|
// Change the max volume for sliders to allow for values above 200
|
||||||
@ -33,11 +45,10 @@ export default definePlugin({
|
|||||||
].map(find => ({
|
].map(find => ({
|
||||||
find,
|
find,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /maxValue:(?<defaultMaxVolumePredicate>\i\.\i)\?(?<higherMaxVolume>\d+?):(?<minorMaxVolume>\d+?),/,
|
match: /(?<=maxValue:\i\.\i)\?(\d+?):(\d+?)(?=,)/,
|
||||||
replace: ""
|
replace: (_, higherMaxVolume, minorMaxVolume) => ""
|
||||||
+ "maxValue:$<defaultMaxVolumePredicate>"
|
+ `?${higherMaxVolume}*$self.settings.store.multiplier`
|
||||||
+ "?$<higherMaxVolume>*Vencord.Settings.plugins.VolumeBooster.multiplier"
|
+ `:${minorMaxVolume}*$self.settings.store.multiplier`
|
||||||
+ ":$<minorMaxVolume>*Vencord.Settings.plugins.VolumeBooster.multiplier,"
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
// Prevent Audio Context Settings sync from trying to sync with values above 200, changing them to 200 before we send to Discord
|
// Prevent Audio Context Settings sync from trying to sync with values above 200, changing them to 200 before we send to Discord
|
||||||
@ -45,16 +56,16 @@ export default definePlugin({
|
|||||||
find: "AudioContextSettingsMigrated",
|
find: "AudioContextSettingsMigrated",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<restOfFunction>updateAsync\("audioContextSettings".{1,50})(?<volumeChangeExpression>return (?<volumeOptions>\i)\.volume=(?<newVolume>\i))/,
|
match: /(?<=updateAsync\("audioContextSettings".{0,50})(?=return (\i)\.volume=(\i))/,
|
||||||
replace: "$<restOfFunction>if($<newVolume>>200)return $<volumeOptions>.volume=200;$<volumeChangeExpression>"
|
replace: (_, volumeOptions, newVolume) => `if(${newVolume}>200)return ${volumeOptions}.volume=200;`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<restOfFunction>Object\.entries\(\i\.localMutes\).+?)volume:(?<volumeExpression>.+?),/,
|
match: /(?<=Object\.entries\(\i\.localMutes\).+?volume:).+?(?=,)/,
|
||||||
replace: "$<restOfFunction>volume:$<volumeExpression>>200?200:$<volumeExpression>,"
|
replace: "$&>200?200:$&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<restOfFunction>Object\.entries\(\i\.localVolumes\).+?)volume:(?<volumeExpression>.+?)}\)/,
|
match: /(?<=Object\.entries\(\i\.localVolumes\).+?volume:).+?(?=})/,
|
||||||
replace: "$<restOfFunction>volume:$<volumeExpression>>200?200:$<volumeExpression>})"
|
replace: "$&>200?200:$&"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -63,24 +74,13 @@ export default definePlugin({
|
|||||||
find: '.displayName="MediaEngineStore"',
|
find: '.displayName="MediaEngineStore"',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<restOfFunction>\.settings\.audioContextSettings.+?)(?<localVolume>\i\[\i\])=(?<syncVolume>\i\.volume)(?<secondRestOfFunction>.+?)setLocalVolume\((?<id>.+?),.+?\)/,
|
match: /(?<=\.settings\.audioContextSettings.+?)(\i\[\i\])=(\i\.volume)(.+?setLocalVolume\(\i,).+?\)/,
|
||||||
replace: ""
|
replace: (_, localVolume, syncVolume, rest) => ""
|
||||||
+ "$<restOfFunction>"
|
+ `(${localVolume}>200?void 0:${localVolume}=${syncVolume})`
|
||||||
+ "($<localVolume>>200?undefined:$<localVolume>=$<syncVolume>)"
|
+ rest
|
||||||
+ "$<secondRestOfFunction>"
|
+ `${localVolume}??${syncVolume})`
|
||||||
+ "setLocalVolume($<id>,$<localVolume>??$<syncVolume>)"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
options: {
|
|
||||||
multiplier: {
|
|
||||||
description: "Volume Multiplier",
|
|
||||||
type: OptionType.SLIDER,
|
|
||||||
markers: makeRange(1, 5, 1),
|
|
||||||
default: 2,
|
|
||||||
stickToMarkers: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
@ -93,8 +93,8 @@ export default definePlugin({
|
|||||||
patches: [{
|
patches: [{
|
||||||
find: ",reactionRef:",
|
find: ",reactionRef:",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /((.)=(.{1,3})\.hideCount)(,.+?reactionCount.+?\}\))/,
|
match: /(?<=(\i)=(\i)\.hideCount,)(.+?reactionCount.+?\}\))/,
|
||||||
replace: "$1,whoReactedProps=$3$4,$2?null:$self.renderUsers(whoReactedProps)"
|
replace: (_, hideCount, props, rest) => `whoReactedProps=${props},${rest},${hideCount}?null:$self.renderUsers(whoReactedProps)`
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user