feat(ShowHiddenChannels): fix channel switch keybinds jumping to hiddens (#459)
Co-authored-by: Nuckyz
This commit is contained in:
parent
bc4c7473e8
commit
6e22a96d9e
1 changed files with 17 additions and 2 deletions
|
@ -64,7 +64,7 @@ const settings = definePluginSettings({
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "ShowHiddenChannels",
|
name: "ShowHiddenChannels",
|
||||||
description: "Show channels that you do not have access to view.",
|
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,
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
@ -178,7 +178,22 @@ export default definePlugin({
|
||||||
match: /(?<=return null!=(?<channel>\i))(?=.{1,130}hasRelevantUnread\(\i\))/,
|
match: /(?<=return null!=(?<channel>\i))(?=.{1,130}hasRelevantUnread\(\i\))/,
|
||||||
replace: "&&!$self.isHiddenChannel($<channel>)"
|
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; }) {
|
isHiddenChannel(channel: Channel & { channelId?: string; }) {
|
||||||
|
|
Loading…
Reference in a new issue