This will delete messages with profanity words then send it in an embed to a log channel of your choice. Change line 26 for your Bot's name. (loosly based off CTK's Profanity filter, Thanks ๐ค)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const random = require('something-random-on-discord').ServerAssistant;
const swearing = await random.checkProfanity(context.params.event.content);
const event = context.params.event;
if (!swearing.profanity) return;
await lib.discord.channels['@0.3.0'].messages.destroy({
message_id: context.params.event.id,
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
});
let msg = event.content;
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: process.env.CHANNEL_LOG_ID,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `A message has been deleted for profanity!`,
description: `**Offender:** ${context.params.event.author.username}#${context.params.event.author.discriminator}
**Reason:** Automatic action carried out for using a profanity.
**Content:** \`${msg}\`
**moderator:** 'YOUR_BOT_NAME'`,
timestamp: new Date().toISOString(),
color: 0x000000,
},
],
});
return await lib.discord.channels['@0.3.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `<@${context.params.event.author.id}> **Your message was deleted for using swear words, please refrain from using them again**`,
});