1.Download regex.js file and put on your "/root" directory
2.Put your codes...
Usage for client message:
constRegex=require(./regex.js);message.channel.send(Regex.stripInvites("some text includes invite code e.g. https://discord.gg/000000"));//-> some text includes invite code e.g. ******
Usage delete invite message from user or bot:
const{ invites }=require(./regex.js);constAllowUser=[// they can send invite code anywhere - ①"userID","userID"]constAllowChannel=[// everyone can send invite code in these channel - ②"channelID","channelID"]client.on('message',asyncmessage=>{if(!AllowUser.includes(message.author)){//①if(!AllowChannel.includes(message.channel)){//②if(invites.includes(message.content)){letmsg=awaitmessage.channel.send("[Do not send invite link this channel]");//msg.delete({timeout:5000}) // delete ↑this message after 5 secreturnmessage.delete({timeout:500});//delete invite message 0.5 sec};}}})