Add Anti-Spam Discord bot

Introduce a new Anti-Spam Discord bot project. Adds project metadata and scripts (package.json, .env.example, .gitignore, README, deploy-commands.js) and the full src implementation: command registration and handling, per-guild settings persistence, configuration parsing, spam detection logic (phishing URLs, suspicious TLDs, mass/role mentions, image+URL combos, new account heuristics), and the bot entrypoint (index.js) that enforces permissions, logs actions, and optionally bans offenders. README explains setup, required intents, and usage; per-server settings are stored under data/guild-settings.json. (package-lock.json added for dependency resolution.)
This commit is contained in:
Andrew Zambazos
2026-06-12 08:10:30 +12:00
commit 7205bcd5ac
12 changed files with 1168 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import "dotenv/config";
import { REST, Routes } from "discord.js";
import { antispamCommands } from "../src/commands.js";
const token = process.env.DISCORD_TOKEN;
const appId = process.env.APPLICATION_ID?.trim();
if (!token) {
console.error("Missing DISCORD_TOKEN in .env");
process.exit(1);
}
if (!appId) {
console.error("Missing APPLICATION_ID in .env");
console.error("Find it in the Developer Portal → General Information → Application ID");
process.exit(1);
}
const guildId = process.env.DEPLOY_GUILD_ID?.trim();
const rest = new REST().setToken(token);
try {
if (guildId) {
await rest.put(Routes.applicationGuildCommands(appId, guildId), {
body: antispamCommands,
});
console.log(`Deployed ${antispamCommands.length} command(s) to guild ${guildId} (instant).`);
} else {
await rest.put(Routes.applicationCommands(appId), { body: antispamCommands });
console.log(`Deployed ${antispamCommands.length} global command(s).`);
console.log("Global commands can take up to an hour to appear in Discord.");
console.log("For instant commands, set DEPLOY_GUILD_ID in .env and run again.");
}
} catch (error) {
console.error("Deploy failed:", error.rawBody ?? error.message);
process.exit(1);
}