khyperia / weechat-discord

Unmaintained! And also apparently this is against their TOS so DON'T USE THIS -- Weechat plugin for Discord support - https://weechat.org/ https://discordapp.com/
MIT License
51 stars 24 forks source link

As of 1bb57f0d640431598da043edb8, channels requiring special access are hidden #33

Open FredrIQ opened 7 years ago

FredrIQ commented 7 years ago

...even if you actually should have access to them.

FredrIQ commented 7 years ago

Actually it's weirder than that. Some channels that I should have access to are hidden, while some nonpublic ones but that I have access to aren't.

khyperia commented 7 years ago

Please paste commit hashes in the main message, and not the title, and if you do so, please decribe what the commit is so that all information is gathed in one place. It makes reading titles of issues much easier, and allows git to link to the commit diff.

This would be a discord-rs bug if so. The only logic in weechat-discord is these lines https://github.com/khyperia/weechat-discord/blob/15b2bd89672957e9161d57b9bf9b5fa15b5947c1/src/connection.rs#L96 and there's nothing there to explain that behavior (but potentially lots to explain it in discord-rs, e.g. the implementation of permissons_for).

(I have double-checked the 1 << 10 value, both discord-rs has the value in a private API, as well as the official discord docs list 0x00000400 as READ_MESSAGES)

Please make sure that this is indeed the reason why the channels are not showing up, and not because you have them muted (as was also introduced in that commit). If so, I'm going to need more information on what exactly these channels you do/don't have access to, as I can't fix a vague "it doesn't work".

FredrIQ commented 7 years ago

OK, I got some time to look a bit into this. Basically this may or may not be a bug in the discord library you depend on.

I added 'MAIN_BUFFER.print(&format!("perms for {}: {}", channel.id(), permissions.bits()))' for blocking and it lists the permissions for a known good channel as 67108864, or 0x4000000 which seems to be "change nickname". This also happens to a fair share of channels I don't have access to. I have currently no way to use an official Discord client or webchat, so I cannot try to figure out what's going on that way. As a temporary measure I special cased the channel ID in the function and it allowed me to read/write things correctly, see nicknames, etc, so I clearly have access to it. I will see if I can investigate this further in a week-ish when I'm back home and can use the official webchat.

khyperia commented 7 years ago

That makes me really really sad :( - I ripped it out for now (revering to old behavior), until we figure something out. A workaround right now would be to mute the channels you don't have access to.

Thank you so much for the research.