bulkDelete erroring: invalid int value

Hey everyone,

I hope you're doing well. I'm currently facing an issue with the channel.bulkDelete() function in Discord.js, and I could really use some assistance.

I'm attempting to use bulkDelete to delete messages stored in the toDelete variable. The toDelete variable is of type Collection<string, Message<true>>, and as per the documentation and a quick check in the Discord.js codebase (screenshot attached), this is an accepted type for the bulkDelete function.

However, when I run the code, I encounter the following error:
DiscordAPIError[50035]: Invalid Form Body
limit[NUMBER_TYPE_MAX]: int value should be less than or equal to 100.


It seems to be expecting a numerical limit less than or equal to 100, even though passing a collection of messages should also be a valid option according to the documentation.

Has anyone else faced a similar issue? If so, could you share how you resolved it? Any insights or solutions would be greatly appreciated!

Thanks in advance!
image.png
Was this page helpful?