Bot will delete any link sent in the channel
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
//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) 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}> Please Do not send any links, they are not allowed.`
});