A Discord bot that enforces per-thread posting restrictions in forum channels and can monitor honeypot channels. In monitored forum threads, only the thread author (OP) and configured staff roles can reply. In honeypot channels, any non-staff account that sends a message is immediately banned.
- A user creates a thread in a monitored forum channel (e.g.
#mod-news) - Someone without permission posts a reply
- The bot deletes the message and posts in the notification channel:
@User Your message in #thread-name was removed — only the thread author and staff may post there. Please read the rules: #rules
For honeypot channels:
- Add one or more channel IDs to
honeypotChannelIds - Any account without a configured staff role that posts in one of those channels is banned
- The bot requests Discord to delete the banned account's last 60 minutes of messages
- Node.js 18+ (or Docker)
- A Discord application with a bot token — discord.com/developers/applications
In the Discord Developer Portal, go to your app → Bot and enable:
- Server Members Intent
- Message Content Intent
Use OAuth2 → URL Generator with scope bot and permissions:
- View Channels
- Read Message History
- Manage Messages
- Send Messages
- Ban Members
Copy .env.example to .env and fill in your bot token:
BOT_TOKEN=your_token_here
Edit config.json:
{
"forumChannelIds": ["ID of the forum channel(s) to monitor"],
"staffRoleIds": ["Role ID(s) that can always post in any thread"],
"honeypotChannelIds": ["ID of honeypot channel(s) where non-staff posts cause an instant ban"],
"notificationChannelId": "Channel ID where violation notices are posted",
"rulesChannelId": "Channel or thread ID linked in violation notices"
}To get IDs: enable Developer Mode in Discord settings, then right-click any channel, role, or thread → Copy ID.
npm install
npm startFor development with auto-restart:
npm run devBuild and run with Docker Compose:
BOT_TOKEN=your_token_here docker compose up -dFor Portainer Stacks:
- Push this repo to Git (
.envis gitignored — the token stays local) - Stacks → Add stack → Repository, point at your repo
- Add
BOT_TOKENunder Environment variables - Deploy
The container is configured with restart: unless-stopped, so it survives crashes and server reboots automatically.
├── index.js # Bot entry point
├── config.json # Channel and role IDs
├── src/
│ ├── config.js # Config loader and validator
│ └── handlers/
│ └── messageCreate.js # Core permission enforcement logic
├── Dockerfile
├── docker-compose.yml
├── .env.example
└── .gitignore