Skip to content

Configuration

This document describes all configurable aspects of Chat Guard and recommended practices for secure and reliable operation.

File: src/config.js

module.exports = {
  Client_Token: "<discord-bot-token>",
  MongoDB_ConnectURL: "<mongodb-connection-string>",
  BotOwners: ["<discord-user-id>", "<optional-second-owner-id>"],
  BotStatus: "Bot is online!",
};
  • Client_Token (required): Discord bot token. Treat as secret.
  • MongoDB_ConnectURL (required): MongoDB connection string. TLS recommended.
  • BotOwners (required): Array of user IDs with developer‑level access.
  • BotStatus (optional): Presence text (e.g., Watching, default configured in code).

Server Policy (stored in MongoDB)

Chat Guard persists per‑server configuration and state in the ChatGuard collection. See Data Model for full schema. Key toggles:

  • CharacterLimit (boolean): enforces 500‑character limit
  • InviteGuard (boolean): blocks Discord invites from non‑whitelisted sources
  • LinkGuard (boolean): blocks generic external links
  • MassPingGuard (boolean): mitigates mass mentions
  • BadWordGuard (boolean): filters profanity list
  • SpamGuard (boolean): blocks burst spam (≥7 messages in 5s)
  • MuteDurationMinute (number): mute duration in minutes (default 60)
  • FiltredWords (array): server‑specific filtered keywords
  • WhiteListMembers|Roles|Channels (arrays): bypass enforcement
  • PunishLogChannelID (string): channel ID for moderation logs
  • Set PunishLogChannelID immediately after onboarding.
  • Keep MuteDurationMinute between 10–120 depending on server risk appetite.
  • Enable InviteGuard, LinkGuard, and SpamGuard for baseline hygiene.
  • Curate FiltredWords to capture community‑specific risks.

Permissions

The bot requires, at minimum: - Manage Messages - Moderate Members (for timeout/mute) - Read/Send Messages - Manage Channels (recommended)

Grant only permissions necessary for your policy posture.

Internationalization

The bot currently sets moment locale to tr for time formatting. If you need a different locale, adjust the locale initialization in src/commands.js.

Secrets Management

Do not commit tokens or connection strings. Use environment managers (e.g., Heroku config vars, GitHub Actions secrets) and inject into src/config.js during deployment, or refactor to load from environment variables.

Back to Docs Index · Next: Architecture → · See also: Commands