aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSofia <me@dzshn.xyz>2023-01-27 21:40:10 -0300
committerGitHub <noreply@github.com>2023-01-28 01:40:10 +0100
commit6e22a96d9eed97ecc1991962fe965ea352ad5549 (patch)
tree5c9cd6db80b6f2ebd1000705e624fcd529f04f03
parentbc4c7473e806bf59c380e486dd1da9c37a819625 (diff)
downloadVencord-6e22a96d9eed97ecc1991962fe965ea352ad5549.tar.gz
Vencord-6e22a96d9eed97ecc1991962fe965ea352ad5549.tar.bz2
Vencord-6e22a96d9eed97ecc1991962fe965ea352ad5549.zip
feat(ShowHiddenChannels): fix channel switch keybinds jumping to hiddens (#459)
Co-authored-by: Nuckyz
-rw-r--r--src/plugins/showHiddenChannels.tsx19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/showHiddenChannels.tsx b/src/plugins/showHiddenChannels.tsx
index e1eff86..283eb83 100644
--- a/src/plugins/showHiddenChannels.tsx
+++ b/src/plugins/showHiddenChannels.tsx
@@ -64,7 +64,7 @@ const settings = definePluginSettings({
export default definePlugin({
name: "ShowHiddenChannels",
description: "Show channels that you do not have access to view.",
- authors: [Devs.BigDuck, Devs.AverageReactEnjoyer, Devs.D3SOX, Devs.Ven, Devs.Nuckyz, Devs.Nickyux],
+ authors: [Devs.BigDuck, Devs.AverageReactEnjoyer, Devs.D3SOX, Devs.Ven, Devs.Nuckyz, Devs.Nickyux, Devs.dzshn],
settings,
patches: [
@@ -178,7 +178,22 @@ export default definePlugin({
match: /(?<=return null!=(?<channel>\i))(?=.{1,130}hasRelevantUnread\(\i\))/,
replace: "&&!$self.isHiddenChannel($<channel>)"
}
- }
+ },
+ // Patch keybind handlers so you can't accidentally jump to hidden channels
+ {
+ find: '"alt+shift+down"',
+ replacement: {
+ match: /(?<=getChannel\(\i\);return null!=(?<channel>\i))(?=.{1,130}hasRelevantUnread\(\i\))/,
+ replace: "&&!$self.isHiddenChannel($<channel>)"
+ }
+ },
+ {
+ find: '"alt+down"',
+ replacement: {
+ match: /(?<=getState\(\)\.channelId.{1,30}\(0,\i\.\i\)\(\i\))(?=\.map\()/,
+ replace: ".filter(ch=>!$self.isHiddenChannel(ch))"
+ }
+ },
],
isHiddenChannel(channel: Channel & { channelId?: string; }) {