fix plugins broken by latest Discord update (#3574)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
fa672a347d
commit
22d3fb10e9
5 changed files with 19 additions and 8 deletions
|
|
@ -292,8 +292,8 @@ export default definePlugin({
|
|||
replacement: [
|
||||
{
|
||||
// Change the role permission check to CONNECT if the channel is locked
|
||||
match: /ADMINISTRATOR\)\|\|(?<=context:(\i)}.+?)(?=(.+?)VIEW_CHANNEL)/,
|
||||
replace: (m, channel, permCheck) => `${m}!Vencord.Webpack.Common.PermissionStore.can(${CONNECT}n,${channel})?${permCheck}CONNECT):`
|
||||
match: /\i\.\i\(\i\.\i\.ADMINISTRATOR,\i\.\i\.VIEW_CHANNEL\)(?<=context:(\i)}.+?)/,
|
||||
replace: (m, channel) => `$self.fixPermCheck(${m},${channel})`
|
||||
},
|
||||
{
|
||||
// Change the permissionOverwrite check to CONNECT if the channel is locked
|
||||
|
|
@ -492,6 +492,16 @@ export default definePlugin({
|
|||
}
|
||||
],
|
||||
|
||||
|
||||
fixPermCheck(originalPerms: bigint, channel: Channel) {
|
||||
if (!PermissionStore.can(PermissionsBits.CONNECT, channel)) {
|
||||
originalPerms &= ~PermissionsBits.VIEW_CHANNEL;
|
||||
originalPerms |= PermissionsBits.CONNECT;
|
||||
}
|
||||
|
||||
return originalPerms;
|
||||
},
|
||||
|
||||
isHiddenChannel(channel: Channel & { channelId?: string; }, checkConnect = false) {
|
||||
try {
|
||||
if (channel == null || Object.hasOwn(channel, "channelId") && channel.channelId == null) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue