I would my bot to delete invites created on my server with a command. I know I can take all invites with message.guild.fetchInvites().then()
, but how do I make my lambda to delete all invites? Thank you in advance and excuse me If it is a dumb question!
CodePudding user response:
You started off well, but here is how to loop through them all and delete them one by one:
message.guild.invites.fetch().then(invites => {
invites.each(i => i.delete())
})
Warning: If there are a lot of invites, you may get ratelimited. You can add a "sleep" function to fix this