This snippet finds bad words in nicknames and changes the nickname, and DM's the user. Simply change the bad words in the if statment, or add more using || nick.includes(`badword3`))
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let nick = context.params.event.nick
if (nick.includes(`badword1`) || nick.includes(`badword2`) || nick.includes(`badword3`)) {
await lib.discord.guilds['@0.1.0'].members.update({
user_id: `${context.params.event.user.id}`,
guild_id: `${context.params.event.guild_id}`,
nick: `Moderated Nick`
});
await lib.discord.users['@0.1.3'].dms.create({
recipient_id: `${context.params.event.user.id}`,
content: `**❗️ | Your nickname contained a banned word, pick a new nickname! **`
});
}