This anti caps will auto warn the user then set one warning (it will add and add if the user keep sending caps message), then it will log it. Get the setup logs at this snippet link - https://autocode.com/snippet/Madara-Uch1ha/cachsnpt_xHDJbNri8dVtHf9T1j56bwiMQF2sWzFPVUEp/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.content.length > 10) { // can be change
if (context.params.event.content.toUpperCase() === context.params.event.content) {
// Paste this to another file of your code
const logchannel = await lib.utils.kv['@0.1.16']
.get({
key: `LOGCHANNEL_${context.params.event.guild_id}`,
})
.then((res) => res);
await lib.discord.channels['@0.1.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `<@!${context.params.event.author.id}> please don't use all caps.`,
});
await lib.utils.kv['@0.1.16'].set({
key: `warns-${context.params.event.author.id}`,
value: 0 + 1,
});
await lib.discord.channels['@0.1.1'].messages.destroy({
message_id: `${context.params.event.id}`,
channel_id: `${context.params.event.channel_id}`,
});
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: logchannel.channel_id,
content: ``,
embeds: [
{
title: `All caps`,
description: `<@${context.params.event.author.id}>, has send all caps in channel <#${context.params.event.channel_id}>`,
},
],
});
}
}