discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.95k stars 1.26k forks source link

Breaking API change around creating threads #5573

Closed MarcusOtter closed 2 years ago

MarcusOtter commented 2 years ago

Description

Up until about 2022-10-20T22:00:00Z my bot had been online for 8 days and working in 3000 servers. Then a breaking API changed happened and it was no longer possible to do the following API request with the bots current permissions:

POST https://discord.com/api/v10/channels/1008115952099020880/messages/1033089960053592164/threads

{
   files: undefined,
   json: {
      name: 'a',
      auto_archive_duration: 1440,
      type: 11,
      invitable: undefined,
      rate_limit_per_user: 0
   }
}

Now, the Manage Threads permission is suddenly required, even if providing a rate limit of 0. Before, this was not the case.

Steps to Reproduce

POST https://discord.com/api/v10/channels/1008115952099020880/messages/1033089960053592164/threads

{
   files: undefined,
   json: {
      name: 'a',
      auto_archive_duration: 1440,
      type: 11,
      invitable: undefined,
      rate_limit_per_user: 0
   }
}

Expected Behavior

I should not need the Manage Threads permission and it should just do what it used to do prior to 2022-10-20T22:00:00Z

I am not changing the slowmode, I am setting it to the same value it already is (0)

Current Behavior

This request returns a Missing Permissions error if the bot does not have Manage Threads

Screenshots/Videos

No response

Client and System Information

Using

MarcusOtter commented 2 years ago

This error goes away if I remove the rate_limit_per_user: 0. But we should have gotten a heads up for this breaking API change, as I had my bot stop working for 3M users, and I had to implement a workaround.

I don't want to be that guy but it's not the first time the API suddenly breaks my bot without a heads up and it makes the DX of working with Discord's API very poor. I don't mean to sound harsh, but it really does make me want to avoid using Discord's API and platform in future projects, which is a shame because I like making Discord bots.

EDIT: Also, I asked in the Discord Developers server and a moderator there just told me that it "makes no sense you're even trying to set it" which is not really the sort of response I expect, why is the blame suddenly on the client regarding how I am using the API? Sure, maybe that's the case that I am using it weirdly, but the API shouldn't break even if I'm relying on weird behavior like this. At the very least, it shouldn't break without a warning so I at least have a chance to fix it before it breaks. I don't know how I could've prevented this situation from happening.

shiftinv commented 2 years ago

We hit this with forum channels a while ago, back when the default_thread_rate_limit_per_user field was added there.

Looks like text channels now also support it? The client UI doesn't show it for text channels yet, but setting the field on text channels works and it gets inherited to threads created in that channel. I suppose that's why specifying rate_limit_per_user: 0 now requires additional perms (even if it matches the default_thread_rate_limit_per_user value :/ )

typpo commented 2 years ago

This is a bug, and it is now fixed