disnake icon indicating copy to clipboard operation
disnake copied to clipboard

feat: implement new forum channel features

Open shiftinv opened this issue 3 years ago • 4 comments

Summary

Resolves #724.

Implements tags, default_thread_slowmode_delay, and default_reaction in forum channels.

The client currently still uses the old tag endpoints, but the proper method is to directly PATCH the forum channel instead which is what this PR does as well, matching the docs. Templates were originally part of this branch a few months ago, but the feature since got API locked and was put on hold for now.

TODO (kinda)

  1. thread_slowmode_delay is not supported on channel creation: https://github.com/DisnakeDev/disnake/blob/c46c995f78dcfe635f0d6b99068834c033833318/disnake/channel.py#L2564

    • see also discord/discord-api-docs#5400
    • can probably defer this to a later PR
  2. ~~Editing a forum channel that has tags with deleted emojis doesn't work, since you always have to provide the full list of tags, but the API rejects unknown emojis. Not exactly sure how that should be solved other than removing emojis that don't exist (according to the emoji cache) ourselves~~

    • edit: ignoring this for now since it's an edge case, and I'd rather not rely on the guild cache for cleaning up unknown emojis in tags
  3. ~~Editing tags requires sending the entire list of tags in the channel; this relies on the channel cache, but if tags are edited/deleted quickly in succession without receiving the CHANNEL_UPDATE from the gw in time, it may send old tag data, reverting previous edits/deletes. Not quite sure what's the best way to solve this: https://github.com/DisnakeDev/disnake/blob/c46c995f78dcfe635f0d6b99068834c033833318/disnake/threads.py#L1219-L1229~~

    • edit: this should no longer be an issue now that bulk-editing has a proper user-facing api

Checklist

  • [x] If code changes were made, then they have been tested
    • [x] I have updated the documentation to reflect the changes
    • [x] I have formatted the code properly by running task lint
    • [x] I have type-checked the code by running task pyright
  • [ ] This PR fixes an issue
  • [x] This PR adds something new (e.g. new method or parameters)
  • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • [ ] This PR is not a code change (e.g. documentation, README, ...)

shiftinv avatar Sep 01 '22 19:09 shiftinv

  • https://github.com/discord/discord-api-docs/issues/5400

onerandomusername avatar Sep 02 '22 04:09 onerandomusername

Editing a forum channel that has tags with deleted emojis doesn't work, since you always have to provide the full list of tags, but the API rejects unknown emojis. Not exactly sure how that should be solved other than removing emojis that don't exist (according to the emoji cache) ourselves

Don't worry, this is currently broken in the client too.

New default_sort_order field on forum channels

I don't think this is documented yet.

onerandomusername avatar Sep 18 '22 01:09 onerandomusername

  • https://github.com/discord/discord-api-docs/pull/5475

onerandomusername avatar Sep 18 '22 01:09 onerandomusername

New default_sort_order field on forum channels

I don't think this is documented yet.

It got documented and then removed from the documentation again a day later, I've removed the field again in 5a56203fd7395a8f2815fce098e1deb3a8ea4ea9.

shiftinv avatar Sep 20 '22 19:09 shiftinv