Unpin all messages when help channel goes dormant#1936
Conversation
|
If they're unpinned when the channel becomes available, then why even bother unpinning when it goes dormant?
Getting pinned messages requires an API call to Discord. With the cache, this is avoided. That is basically the only advantage. That being said, this sort of optimisation is not necessary; it was nice to have but it's not worth keeping if it's causing consistency issues. |
Apparently, it's the API itself that bugs out occasionally, and making two passes will decrease the likelihood that there are pins remaining by the time the channel becomes available.
That is true.
As stated above, it's allegedly the API and not the cache that caused the issue. I just prefer the solution in this PR because it reduces code complexity. |
MarkKoz
left a comment
There was a problem hiding this comment.
This will allow a discord.Message to be passed to pin_wrapper instead of a message ID. Thus, the wrapper will be able to call the discord.Message.pin and discord.Message.unpin functions rather than using the undocumented methods on HTTPClient. Would you mind updating the wrapper function too @dementati?
|
@dementati What's your status on this PR? |

As described in #1903, unpinning a help channel question will occasionally fail when a channel goes dormant. This issue was previously fixed in #1909 by querying and unpinning all pinned messages in the help channel when it moves from dormant to available. This likely fixes the issue, but the current unpinning solution is still unnecessarily complex.
Unpinning the question when the channel goes dormant is currently solved by storing the question message ID when the channel is first claimed and retrieving it from there to be unpinned at the appropriate time. An alternative and simpler solution, implemented in this PR, is to query all pinned messages and unpin those found, like what happens when the channel becomes available. This allows us to get rid of the message cache with no known disadvantages.