Skip to content

Implement dev-chatter warning #9

@Arlodotexe

Description

@Arlodotexe

Background

The devChatterWarning.ts script is a TypeScript module designed for a Discord bot that moderates the content of messages in specific channels. Its primary purpose is to ensure that technical discussions and disallowed domains are kept out of non-technical channels. If a violation is detected, the bot issues a warning to the user and guides them to the appropriate channels for their discussions.

This script is implemented using the discord.js library and leverages regular expressions and web requests to validate the content of messages. The current implementation uses traditional message event handling and text-based commands.

Problem

The existing implementation has the following limitations:

  1. Outdated Command Style: The bot uses legacy commands like !portal, which are less intuitive and modern compared to Discord's slash commands.
  2. Static Domain Handling: The script relies on a hardcoded list of disallowed domains for validation. This makes it inflexible to updates without code changes.
  3. Reliance on Manual Regular Expressions: The script parses content using several custom regular expressions, which can be error-prone and difficult to maintain.

Solution

To modernize and improve this feature, we propose re-implementing it using Discord's slash commands and a more modular, flexible design.

Functional Requirements

  1. Automated Moderation: Retain automated detection of disallowed domains and technical discussions in non-technical channels.
  2. (optional) Dynamic Domain Handling: Use a configurable and extensible system for managing disallowed and allowed domains/keywords.

Technical Requirements

  1. Slash Command Framework: Use the modern interaction APIs for warnings.
  2. Testing and Logging: Implement unit tests for easier debugging and maintenance.
  3. (optional) Configuration Management: Use a SettingsBase to manage allowed or disallowed domains and keywords, implement behind a slash command.
  4. (optional) Content Validation: Replace manual regular expressions with a utility class or library for parsing and validating message content.

Spec Outline

Automated Moderation

  • Triggers:
    • Message in a monitored channel.
    • Domain matches the disallowed list.
    • Technical discussion detected in a non-technical channel.
  • Actions:
    • Warn the user with an "only you can see this" bot message, a reply, or DM.
    • Use the existing warning message. Guide the user to the appropriate channels.
    • Deletion Monitoring: Automatically delete the warning if the offending message is removed.

Modular Architecture

  • Message Processor: A utility for parsing and validating message content.
  • Warning Handler: Manages warning messages and user interactions.
  • Domain Validator: Checks message content against allowed and disallowed domains dynamically.

Example Workflow

  1. User posts a message in user-chat containing a disallowed domain.
  2. Bot detects the domain and issues a warning with a prompt to move the discussion.
  3. If the message is deleted, the bot removes the associated warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Ready

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions