Skip to content

Implement Slash Commands to Reduce Message Content Intent Reliance - #3453

Open
lorenzo132 wants to merge 16 commits into
developmentfrom
users/lorenzo132/slashcommands-intent-requirement
Open

Implement Slash Commands to Reduce Message Content Intent Reliance#3453
lorenzo132 wants to merge 16 commits into
developmentfrom
users/lorenzo132/slashcommands-intent-requirement

Conversation

@lorenzo132

Copy link
Copy Markdown
Member

No description provided.

Copilot AI lite review requested due to automatic review settings August 3, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Modmail to v4.3.0 and introduces a slash-command compatibility layer (guild-scoped) to reduce reliance on the privileged message-content intent, alongside new support for snippet attachments stored in MongoDB GridFS.

Changes:

  • Add guild-scoped slash command registration/refresh and disable legacy prefix commands by default (with intent gating).
  • Add snippet attachment upload/download/delete via GridFS and wire snippet attachments into thread sending/logging.
  • Update documentation/config examples and bump version references to v4.3.0.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Updates feature/command docs to slash-command + mention invocation model and adds command-interface guidance.
pyproject.toml Bumps Poetry package version to 4.3.0.
core/thread.py Adds snippet-attachment handling during send and logging.
core/slash_commands.py Introduces a manager to expose legacy commands as guild-scoped application commands.
core/config.py Adds config keys for command interfaces and snippet attachment size (MB) handling.
core/config_help.json Documents snippet_attachment_max_size.
core/clients.py Adds GridFS bucket support and snippet-attachment CRUD methods; extends logging API to accept attachment overrides.
cogs/utility.py Switches user-facing examples/help formatting to support “/” display prefix and safer {prefix} substitution.
cogs/plugins.py Refreshes slash command registry on plugin load/unload; updates installation examples.
cogs/modmail.py Adds snippet attachment support (create/edit/remove) and adapts snippet display for new storage format.
CHANGELOG.md Bumps changelog header to v4.3.0.
bot.py Gates message-content intent behind prefix-enable flag; adds slash command sync/disable on connect; adds snippet attachment download wrapper.
app.json Adds env var metadata for MODMAIL_GUILD_ID / USE_SLASH_COMMANDS / ENABLE_PREFIX_COMMANDS.
.env.example Adds new env vars for slash/prefix command controls and optional MODMAIL_GUILD_ID.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/thread.py Outdated
Comment thread cogs/modmail.py Outdated
Comment thread core/slash_commands.py Outdated
Copilot AI review requested due to automatic review settings August 3, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (4)

cogs/modmail.py:667

  • Same as in snippet_add: a negative snippet_attachment_max_size results in a negative byte limit and rejects all uploads. Clamp/validate before computing max_size_bytes.
                max_size_mb = self.bot.config.get("snippet_attachment_max_size")
                max_size_bytes = max_size_mb * 1024 * 1024

core/slash_commands.py:103

  • REQUIRED_SLASH_PARAMETERS forces the message option to be required for /reply variants even though the legacy commands accept an empty msg (e.g. reply(..., msg: str = "")). This blocks valid slash use-cases like attachment-only replies/snippets.
    REQUIRED_SLASH_PARAMETERS = {
        "areply": {"msg"},
        "fareply": {"msg"},
        "fpareply": {"msg"},
        "fpreply": {"msg"},
        "freply": {"msg"},
        "pareply": {"msg"},
        "preply": {"msg"},
        "reply": {"msg"},
    }

cogs/modmail.py:410

  • snippet_attachment_max_size can be configured to a negative value, which makes max_size_bytes negative and causes every attachment to be rejected. Clamp to a non-negative size (or explicitly validate and error) before computing bytes.

This issue also appears on line 666 of the same file.

            max_size_mb = self.bot.config.get("snippet_attachment_max_size")
            max_size_bytes = max_size_mb * 1024 * 1024

cogs/utility.py:384

  • "Checkout" is the noun/verb for completing a purchase; here the intended phrase is "Check out" (verb) meaning “take a look at”.
                "Checkout the people who supported Modmail with command "
                f"`{self.bot.command_display_prefix}sponsors`!"

Copilot AI review requested due to automatic review settings August 4, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

cogs/utility.py:385

  • Grammar: "Checkout" should be "Check out" in this user-facing help text.
            value=(
                "Checkout the people who supported Modmail with command "
                f"`{self.bot.command_display_prefix}sponsors`!"
            ),

Comment thread cogs/modmail.py
Comment on lines +402 to +406
# Handle optional attachment
file_id = None
attachment_info = None
if ctx.message.attachments:
attachment = ctx.message.attachments[0]
@StephenDaDev StephenDaDev changed the title Users/lorenzo132/slashcommands intent requirement Implement Slash Commands to Reduce Message Content Intent Reliance Aug 5, 2026
@StephenDaDev StephenDaDev added priority: high changelog Changes in PR have been added to draft release that will be used for the changelog on the next ver. labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Changes in PR have been added to draft release that will be used for the changelog on the next ver. priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants