Skip to content

Instantly share code, notes, and snippets.

@ember-ana
Last active April 4, 2025 00:05
Show Gist options
  • Save ember-ana/9c4045b0a1fbec015a007ac702c424dc to your computer and use it in GitHub Desktop.
Save ember-ana/9c4045b0a1fbec015a007ac702c424dc to your computer and use it in GitHub Desktop.
Context: I linked this in a Reddit comment, as an example of how little code is necessary to start automating moderation yourself
const { Client } = require('discord.js');
const token = 'YOUR_FANCY_DISCORD_TOKEN';
client = new Client();
const spamBotUrls = [
'privatepage.vip',
'nakedphotos.club'
];
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}.`);
});
client.on('message', msg => {
if (spamBotUrls.some(url => msg.content.includes(url)) {
msg.delete();
/* Optionally ban:
* msg.member.ban('Detected Spambot URL');
*/
}
});
client.login(token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment