Im trying to code my discord bot to prevent advertising other discords. I've read a lot on this site, but can't find the solution. I want the bot to search for discord invites in a message, and if this link is not posted by a member that has the kick permission, then it should delete the invite.
if (message.content.includes('discord.gg/'||'discordapp.com/invite/')) { //if it contains an invite link
if(!message.member.hasPermission("KICK_MEMBERS")) {
message.delete() //delete the message
.then(message.member.send(ms.INVITELINK));
}}