Last active
April 4, 2025 00:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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