ShadowGuard is a Discord bot for protecting and running a community. It provides anti-nuke controls, moderation, logging, leveling, tickets, reaction roles, giveaways, polls, custom commands, and optional music playback.
You need Node.js 20+, a MongoDB database, and a Discord application with a bot user.
-
In the Discord Developer Portal, enable Server Members Intent, Message Content Intent, and Presence Intent for the bot.
-
Create a MongoDB database, then install and configure the project:
git clone <repository-url> cd shadowguard npm install
PowerShell:
Copy-Item .env.example .envmacOS or Linux:
cp .env.example .env
-
Set these values in
.env:DISCORD_TOKEN=your-bot-token CLIENT_ID=your-application-id MONGODB_URI=mongodb://127.0.0.1:27017/shadowguard
-
Register slash commands and start the bot:
npm run deploy npm start
Use npm run dev during development. Set GUILD_ID in .env to deploy commands to one test server immediately; leave it blank for global deployment.
Only DISCORD_TOKEN, CLIENT_ID, and MONGODB_URI are required. .env.example documents all optional settings.
PREFIXchanges the message-command prefix (default:,).GUILD_IDscopes slash-command deployment to a test server.LAVALINK_HOST,LAVALINK_PORT, andLAVALINK_PASSWORDconfigure a music node you control.LASTFM_API_KEY,TRANSLATION_API_URL, andPREMIUM_WEBHOOK_SECRETenable their respective integrations.
Keep .env out of version control. Store production values in your hosting provider's secret manager and rotate any credential that may have been exposed.
- Start in a test server. Moderation and anti-nuke commands can change member, role, and channel access.
- Grant the bot only the permissions required for the features you enable.
- Music uses Lavalink. A self-hosted node is recommended for production; public-node fallback availability is not guaranteed.
- Run
/helpor,helpin Discord to discover available commands.
npm test -- --runInBand
npm run lint
npm run format:check
npm auditProject conventions and architecture: docs/DEVELOPMENT.md Contributing: CONTRIBUTING.md Security reporting: SECURITY.md