Farcrada / DiscordPlugins

This repo holds all the plugins I made for Discord.
GNU Affero General Public License v3.0
114 stars 64 forks source link

Fix discord crash when use ShowHiddenChannels plugin #64

Closed book777 closed 3 years ago

book777 commented 3 years ago

https://github.com/mwittrien/BetterDiscordAddons/blob/master/Plugins/ShowHiddenChannels/ShowHiddenChannels.plugin.js

Farcrada commented 3 years ago

Did you check if version 4.0.1 works? Because if that one works I'm curious to see what your console returns.

book777 commented 3 years ago

Discord was crashed on 4.0.1 for me

Farcrada commented 3 years ago

What does the console say?

book777 commented 3 years ago

That the channel in getPermissionsOfChannel is undefined

Farcrada commented 3 years ago

Right, Have you tried 4.0.1? I uploaded it just before you made the pull request: https://github.com/Farcrada/DiscordPlugins/commit/fe0a2a8cc346ae870737f0c8d41d45c87d13585b 4.0.1: https://github.com/Farcrada/DiscordPlugins/blob/master/Channel-Permissions/ChannelPermissions.plugin.js

Let me know if that solves the issue as well, or if you run into other issues.

book777 commented 3 years ago

No, the fe0a2a8 is still crashes

book777 commented 3 years ago

image

book777 commented 3 years ago

image

Farcrada commented 3 years ago

Can you see what parent_id is on your line: 502? I'm wondering why it fails this check:

if (!channel.parent_id) <--
    return { topic: channel.topic };
book777 commented 3 years ago

image

Farcrada commented 3 years ago

There we have our issue! Thank you very much!

book777 commented 3 years ago
            if (!channel.parent_id)
                //if not, simply return with a topic
                return { topic: channel.topic };

            const parentChannel = this.getChannel(channel.parent_id);
            if (!parentChannel)
                return { topic: channel.topic };

            const parentPerms = this.getPermissionsOfChannel(parentChannel),
                channelPerms = this.getPermissionsOfChannel(channel);

            //Return with topic and sync property
            return { topic: channel.topic, categorySynced: JSON.stringify(parentPerms) === JSON.stringify(channelPerms) };
        }

works fine for me

Farcrada commented 3 years ago

Let me know if that fixes it for you as well!

book777 commented 3 years ago

Your solution didn't helps image

Farcrada commented 3 years ago

It doesn't work when you hover over channels? Or just there in the console?

Farcrada commented 3 years ago

You can @ me in the BetterDiscord server so communications will go a bit smoother, if you want.