fix plugins broken by latest Discord update (#3574)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
sadan4 2025-08-03 09:05:26 -04:00 committed by GitHub
parent fa672a347d
commit 22d3fb10e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 8 deletions

View file

@ -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;