Skip to content

AdvancedDiscordBot/adb-plugin-automod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adb-plugin-automod

Content filtering plugin with configurable rules, whitelists, and actions for Advanced Discord Bot (ADB).

Features

  • Filter Pipeline (Optimized, fast checks run first):

    • Invite: Blocks Discord invite links (e.g. discord.gg/code).
    • Link: Blocks external URLs, supporting a domain whitelist.
    • Caps: Flags messages exceeding a threshold of uppercase characters (default: 70%).
    • Mention: Flags messages containing too many @member mentions (default: 5).
    • Emoji: Flags messages containing too many emojis (Unicode and custom, default: 5).
    • Word: Blocks bad words/phrases supporting wildcards (e.g. *bad*, exactword, starts*).
    • Spam: Detects rapid messaging, consecutive duplicate messages, and repeated duplicate characters.
  • Action Suite:

    • delete: Deletes the offending message.
    • warn: Deletes the message, issues a guild warning to the user's profile, DMs the user, and logs the incident.
    • mute: Deletes the message, applies a standard 10-minute timeout to the user, DMs the user, and logs the incident.
    • timeout: Deletes the message, applies a custom-duration timeout to the user, DMs the user, and logs the incident.
    • log: Deletes the message and logs the incident to the configured moderation log channel.
  • Whitelisting:

    • Excludes channels or roles from specific filters (or all filters entirely).

Commands

  • /automod rule add [type] [action] [threshold?] [words?] [duration?]
    • Adds a new rule for a filter type.
  • /automod rule remove [rule_id|type]
    • Removes a rule by its database ID or filter type name.
  • /automod rule edit [rule_id|type] [action?] [threshold?] [words?] [duration?] [enabled?]
    • Edits an existing rule's configuration.
  • /automod list
    • Lists all configured AutoMod rules and whitelists.
  • /automod whitelist [type] [filter] [channel?] [role?]
    • Toggles a whitelist entry for a channel or role.
  • /automod action [type] [action?]
    • Views or sets the action for a given filter type.

Project Structure

adb-plugin-automod/
├── plugin.json         # Manifest file with bot permissions
├── index.js            # Entry point: registers commands/models, listens to messageCreate
├── commands/
│   └── automod.js      # Slash command handling
├── models/
│   ├── rule.js         # AutoModRule Mongoose schema
│   └── whitelist.js    # Whitelist Mongoose schema
├── lib/
│   └── parseDuration.js # Shared utility for duration parsing
└── test/
    ├── mock-ctx.js     # Mock plugin context for offline testing
    └── local-harness.js # Offline test harness

Testing

Run tests locally without requiring a live Discord connection or MongoDB database:

npm install
npm test

License

This project is licensed under the GNU Affero General Public License v3.0. See the LICENSE file for details.

About

Advanced AutoMod plugin for ADB with spam, link, word, caps, mention, emoji, invite filters and actions: delete, warn, mute, timeout, log.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages