Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

The permissions middleware was blocking all commands in DMs regardless of whether they required permission validation, showing a "Server-only command" error even for commands without userPermissions or botPermissions metadata.

Changes

  • Moved permission requirement extraction (userPermissions/botPermissions) before the DM channel check
  • Early return when no permissions are specified, allowing DM commands to proceed normally
  • DM blocking now only triggers for commands that actually require permission validation

Commands without permission metadata now work in DMs. Commands with permission requirements are still blocked in DMs since guild permissions cannot be validated there.

Original prompt

This section details on the original issue you should resolve

<issue_title>Middelware problem for DM's</issue_title>
<issue_description>i had a discussion with Twilight, and seems: That middleware needs to only execute in appropriate situations

But he does not do that.</issue_description>

<agent_instructions>This issue is coming from packages/commandkit/src/app/middlewares/permissions.ts which is ALWAYS applying DM checks without checking if permission validation should be performed (i.e. command metadata specifies user/bot permissions). This middleware should only continue if permission validation is required, otherwise returning early. Only fix the middleware execution logic and do not try to run tests or any checks.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
commandkit Ignored Ignored Preview Jan 29, 2026 0:46am

…lidation is needed

Co-authored-by: twlite <46562212+twlite@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix middleware problem for DM checks Fix permissions middleware to only apply DM checks when permission validation is needed Jan 29, 2026
Copilot AI requested a review from twlite January 29, 2026 12:47
@twlite twlite marked this pull request as ready for review January 29, 2026 13:00
@twlite twlite merged commit 3660477 into main Jan 29, 2026
4 checks passed
@twlite twlite deleted the copilot/fix-middleware-execution-logic branch January 29, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Middelware problem for DM's

2 participants