im pretty new to javascript and i tried to get and modify a script that delete link if its not in the list, i tried multiple modification for hours but none succeed, the bot delete all link. What have i missed ?
var channelID = ["974353308800139354","770229235788677161"]
//Credits: https://stackoverflow.com/questions/6707476/how-to-find-if-a-text-contains-url-string
const regexChecker = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi.test(context.params.event.content)
if((!regexChecker)||(channelID.includes(message.channel.id))) return;
/* Delete Message */
await lib.discord.channels['@0.1.1'].messages.destroy({
message_id: context.params.event.id,
channel_id: context.params.event.channel_id
});
/* Send the alert message */
return await lib.discord.channels['@0.1.1'].messages.create({
channel_id: context.params.event.channel_id,
content: `<@${context.params.event.author.id}> You cant post link here.`
});