discord-delete icon indicating copy to clipboard operation
discord-delete copied to clipboard

Error deleting message: Bad status code Bad Request when encountering archived channel messages

Open larryqiann opened this issue 2 years ago • 2 comments

Hi,

I am receiving the error as follows:

INFO[0264] Deleting message 8xxxxx from channel 8xxxxxxxx
DEBU[0264] DELETE https://discord.com/api/v8/channels/8xxxxxxx/messages/8xxxxxxxxxx
DEBU[0264] Server returned status Bad Request           
FATA[0264] Error deleting message: Bad status code Bad Request 

When I manually put this channel ID into the web Discord, it shows that the channel name is of an archived thread in a server that has some threads that were auto archived. These are not deletable, even in the UI.

Since this appears to stop the process and block, I am wondering if it would be possible to detect this case and skip the messages, possibly notifying the user of this situation.

Thanks

larryqiann avatar Jul 18 '22 02:07 larryqiann

Need to add a check to see if the message is in an archived thread. This information isn't available from the messages endpoint - will need to do a lookup of the channel ID.

It would also be worth checking if the user can unarchive the thread.

cedws avatar Aug 01 '22 00:08 cedws

I've added a check in 1.7.0 to see if the message is in an archived or locked thread before attempting deletion. For now, such messages will be skipped, but in a future release I'd like to add some code to try and unarchive/unlock the thread.

cedws avatar Aug 10 '22 18:08 cedws