Skip to content

fix: 🧑‍💻 Add kwargs explicitly for app-command decorators#3119

Open
ToothyDev wants to merge 8 commits intoPycord-Development:masterfrom
ToothyDev:fix/command-decorator-typing
Open

fix: 🧑‍💻 Add kwargs explicitly for app-command decorators#3119
ToothyDev wants to merge 8 commits intoPycord-Development:masterfrom
ToothyDev:fix/command-decorator-typing

Conversation

@ToothyDev
Copy link
Contributor

Summary

This explicitly adds typed kwargs to the slash_command, user_command and message_command decorators as well as to the basic application_command decorator.

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@pycord-app
Copy link

pycord-app bot commented Feb 21, 2026

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/3119/head:pr-3119
git checkout pr-3119

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3119/head

Paillat-dev
Paillat-dev previously approved these changes Feb 28, 2026
Copy link
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

Should do the trick for now

Paillat-dev
Paillat-dev previously approved these changes Feb 28, 2026
Copy link
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

Should do the trick for now

Signed-off-by: ToothyDev <55001472+ToothyDev@users.noreply.github.com>
Paillat-dev
Paillat-dev previously approved these changes Mar 9, 2026
@Soheab
Copy link
Contributor

Soheab commented Mar 17, 2026

Why are none of these kwargs only? This will look confusing to the "beginning" users.

@ToothyDev
Copy link
Contributor Author

opinions @Paillat-dev @JustaSqu1d

@Paillat-dev
Copy link
Member

@Soheab is right. Where the original only accepted **kwargs these should be kwarg-only as well.

@Lulalaby Lulalaby added this to Pycord Mar 18, 2026
@github-project-automation github-project-automation bot moved this to Todo in Pycord Mar 18, 2026
Copy link
Member

@plun1331 plun1331 left a comment

Choose a reason for hiding this comment

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

whatever the other person said about kwargs

Co-authored-by: plun1331 <plun1331@gmail.com>
Signed-off-by: ToothyDev <55001472+ToothyDev@users.noreply.github.com>
Copy link
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

lgtm

nsfw: bool = False,
options: list[Option] | None = MISSING,
parent: SlashCommandGroup | None = MISSING,
**kwargs: Any,
Copy link
Member

Choose a reason for hiding this comment

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

Since all applicable kwargs are explicitly typed now, shouldn't we remove this?

Copy link
Member

Choose a reason for hiding this comment

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

We could but it would break for people that were passing non-existent params previously. Which is kinda their fault but we also did accept **kwargs. I am fine either ways personally.

Copy link
Member

Choose a reason for hiding this comment

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

we should remove it def in future. but for rn. lets do a vote in discord

Copy link
Member

Choose a reason for hiding this comment

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

I think we should remove it in this pull request while we're at it tbh. We did allow **kwargs but non-existent params had no effect anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could disallow it at type checking using overloads or if TYPE_CHECKING: ...

Copy link
Member

Choose a reason for hiding this comment

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

I agree w/soheab. And maybe have a deprecation warning or runtime warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think overloads will be messy here for all these different functions, I'd be on Doru's side. This isn't breaking correct code.

Copy link

Choose a reason for hiding this comment

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

What about **kwargs: Never? Type checkers will reject unknown kwargs at call sites, and it won't cause any runtime crashes for existing callers (nevertheless, removing **kwargs completely seems the best).

Copy link
Member

@Paillat-dev Paillat-dev Mar 22, 2026

Choose a reason for hiding this comment

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

Note that guild_only is missing from all of these, and while it is deprecated, its deprecation is entirely separate from any potential deprecation/breakage we might have here. It should still be allowed where it was before. We haven't specified any removal date for guild_only=value in its own deprecation notice.

@Paillat-dev Paillat-dev added this to the v2.8.0 milestone Mar 22, 2026
@Paillat-dev Paillat-dev requested a review from a team March 22, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

8 participants