From f0240ec3457aff627b56d75876a8ed9fc8a98a5d Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sat, 7 Jan 2023 22:15:22 -0300 Subject: chore(plugins): Fix IgnoreActivities & clean up other plugins (#384) --- src/plugins/DisableDMCallIdle.ts | 35 ----------------------------------- src/plugins/disableDMCallIdle.ts | 35 +++++++++++++++++++++++++++++++++++ src/plugins/ignoreActivities.tsx | 16 ++++++++-------- src/plugins/volumeBooster.ts | 20 ++++++++++---------- 4 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 src/plugins/DisableDMCallIdle.ts create mode 100644 src/plugins/disableDMCallIdle.ts (limited to 'src') diff --git a/src/plugins/DisableDMCallIdle.ts b/src/plugins/DisableDMCallIdle.ts deleted file mode 100644 index c620f54..0000000 --- a/src/plugins/DisableDMCallIdle.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "DisableDMCallIdle", - description: "Disables automatically getting kicked from a DM voice call after 5 minutes.", - authors: [Devs.Nuckyz], - patches: [ - { - find: ".Messages.BOT_CALL_IDLE_DISCONNECT", - replacement: { - match: /function (?.{1,3})\(\){.{1,100}\.Messages\.BOT_CALL_IDLE_DISCONNECT.+?}}/, - replace: "function $(){}", - }, - }, - ], -}); diff --git a/src/plugins/disableDMCallIdle.ts b/src/plugins/disableDMCallIdle.ts new file mode 100644 index 0000000..c620f54 --- /dev/null +++ b/src/plugins/disableDMCallIdle.ts @@ -0,0 +1,35 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2022 Vendicated and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +export default definePlugin({ + name: "DisableDMCallIdle", + description: "Disables automatically getting kicked from a DM voice call after 5 minutes.", + authors: [Devs.Nuckyz], + patches: [ + { + find: ".Messages.BOT_CALL_IDLE_DISCONNECT", + replacement: { + match: /function (?.{1,3})\(\){.{1,100}\.Messages\.BOT_CALL_IDLE_DISCONNECT.+?}}/, + replace: "function $(){}", + }, + }, + ], +}); diff --git a/src/plugins/ignoreActivities.tsx b/src/plugins/ignoreActivities.tsx index a85e501..cfaaafd 100644 --- a/src/plugins/ignoreActivities.tsx +++ b/src/plugins/ignoreActivities.tsx @@ -35,7 +35,7 @@ interface IgnoredActivity { } const RegisteredGamesClasses = findByPropsLazy("overlayToggleIconOff", "overlayToggleIconOn"); -const PreviewBadgeClasses = findByPropsLazy("previewBadge", "previewBadgeIcon"); +const TryItOutClasses = findByPropsLazy("tryItOutBadge", "tryItOutBadgeIcon"); const BaseShapeRoundClasses = findByPropsLazy("baseShapeRound", "baseShapeRoundLeft", "baseShapeRoundRight"); const RunningGameStore = findByPropsLazy("getRunningGames", "getGamesSeen"); @@ -116,7 +116,7 @@ function ToggleActivityComponent({ activity }: { activity: IgnoredActivity; }) { function ToggleActivityComponentWithBackground({ activity }: { activity: IgnoredActivity; }) { return (
@@ -145,11 +145,11 @@ export default definePlugin({ patches: [{ find: ".Messages.SETTINGS_GAMES_OVERLAY_ON", replacement: { - match: /(this.renderLastPlayed\(\)]}\),this.renderOverlayToggle\(\))/, - replace: "$1,Vencord.Plugins.plugins.IgnoreActivities.renderToggleGameActivityButton(this.props)" + match: /this.renderLastPlayed\(\)]}\),this.renderOverlayToggle\(\)/, + replace: "$&,Vencord.Plugins.plugins.IgnoreActivities.renderToggleGameActivityButton(this.props)" } }, { - find: ".Messages.NEW,name", + find: ".overlayBadge", replacement: { match: /.badgeContainer.+?.\?\(0,.\.jsx\)\(.{1,2},{name:(?.)\.name}\):null/, replace: "$&,Vencord.Plugins.plugins.IgnoreActivities.renderToggleActivityButton($)" @@ -157,8 +157,8 @@ export default definePlugin({ }, { find: '.displayName="LocalActivityStore"', replacement: { - match: /((.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?;)/, - replace: "$1$2=$2.filter(Vencord.Plugins.plugins.IgnoreActivities.isActivityEnabled);" + match: /(?.)\.push\(.\({type:.\..{1,3}\.LISTENING.+?\)\)/, + replace: "$&;$=$.filter(Vencord.Plugins.plugins.IgnoreActivities.isActivityIgnored);" } }], @@ -207,7 +207,7 @@ export default definePlugin({ ); }, - isActivityEnabled(props: { type: number; application_id?: string; name?: string; }) { + isActivityIgnored(props: { type: number; application_id?: string; name?: string; }) { if (props.type === 0) { if (props.application_id !== undefined) return !ignoredActivitiesCache.has(props.application_id); else { diff --git a/src/plugins/volumeBooster.ts b/src/plugins/volumeBooster.ts index dab6b93..49d9d54 100644 --- a/src/plugins/volumeBooster.ts +++ b/src/plugins/volumeBooster.ts @@ -29,21 +29,21 @@ export default definePlugin({ { find: ".Messages.USER_VOLUME", replacement: { - match: /maxValue:(.{1,2}\..{1,2})\?(\d+?):(\d+?),/, - replace: (_, defaultMaxVolumePredicate, higherMaxVolume, minorMaxVolume) => "" - + `maxValue:${defaultMaxVolumePredicate}` - + `?${higherMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier` - + `:${minorMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier,` + match: /maxValue:(?.{1,2}\..{1,2})\?(?\d+?):(?\d+?),/, + replace: "" + + "maxValue:$" + + "?$*Vencord.Settings.plugins.VolumeBooster.multiplier" + + ":$*Vencord.Settings.plugins.VolumeBooster.multiplier," } }, { find: "currentVolume:", replacement: { - match: /maxValue:(.{1,2}\..{1,2})\?(\d+?):(\d+?),/, - replace: (_, defaultMaxVolumePredicate, higherMaxVolume, minorMaxVolume) => "" - + `maxValue:${defaultMaxVolumePredicate}` - + `?${higherMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier` - + `:${minorMaxVolume}*Vencord.Settings.plugins.VolumeBooster.multiplier,` + match: /maxValue:(?.{1,2}\..{1,2})\?(?\d+?):(?\d+?),/, + replace: "" + + "maxValue:$" + + "?$*Vencord.Settings.plugins.VolumeBooster.multiplier" + + ":$*Vencord.Settings.plugins.VolumeBooster.multiplier," } } ], -- cgit