Discord.js: bulkDelete delete channels with the messages ?

Created on 13 Aug 2017  路  12Comments  路  Source: discordjs/discord.js

It seems like when there are no messages in the channel, bulkDelete simply delete the channel
The logs of the bot :

C:\Users\cl茅ment\IdeaProjects\ClemCacahuete>node clemcacahuete_bot.js
Created webhook with token: sxD-jxQM-xNsKkfvY6X0NnBMxpYbmM_R7YX66cYoqAxSlqbRLoz1bS7UKqQsIWhmLJjD and ID: 336896802722938880
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): DiscordAPIError: Unknown Channel
(node:12992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Unknown Channel
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): DiscordAPIError: Unknown Channel
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): DiscordAPIError: Unknown Channel
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): DiscordAPIError: Unknown Channel
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): DiscordAPIError: Unknown Channel
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): DiscordAPIError: Unknown Channel
(node:12992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): DiscordAPIError: Unknown Channel
[...] //i have a second test on a second channel, it's the same thing until the 25th
}else if (message.content === prefixgeneral+"Delete Cacahu猫te" || prefixgeneral+"Delete Cacahu猫te") {
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.bulkDelete(100)
            message.channel.send("nettoyage qualit茅 :peanuts: !!!")
            message.channel.delete(5000)
            message.channel.bulkDelete(1)
        }

Further details:

  • last version:
  • last version:
  • windows 10:
  • It's not an big issue, but it can be problematic for the users of the bot

  • [x] I found this issue while running code on a __user account__
  • [ ] I have also tested the issue on latest master, commit hash:

ps : thanks to the one who said me to delete the webhook :D I forgot that it was write in the issue

question (please use Discord instead)

Most helpful comment

im not even sure if a webhook can use bulkDelete 馃

All 12 comments

im not even sure if a webhook can use bulkDelete 馃

the bulkDelete doesn't have any relation with the webhook 馃槃

sure it have 馃

i didn't use the webhook to bulkDelete

Why even bulkDelete if you're deleting the channel anyway

the problem is that : if you clean the channel, what do you do if the clean delete the channel with the messages...

He is asking why do you bulkDelete the messages when you intend to delete the channel anyway? It's useless. The messages are gone the moment you delete the channel, there is no point in having them be bulkDeleted beforehand.

i understand, but what i am saying is that if you want to keep the channel and just bulkDelete the messages...

Regardless of the inanity of what you're doing, the issue you're having is not a problem with the library. Please ask questions such as this in relevant discord servers.

Why do you call message.channel.delete(5000) then?

You can bulkDelete messages just fine, however you are deleting the channel before the bulkDeleting is even done, thus throwing that error.

ooops, i forgot to delete message.channel.delete, my bad, i'll close the issue 馃槩

Was this page helpful?
0 / 5 - 0 ratings