Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adds docstrings for some properties of InvokableSlashCommand and SubCommand and document Option's attributes #1112

Merged
merged 25 commits into from
Nov 22, 2023

Conversation

Snipy7374
Copy link
Collaborator

@Snipy7374 Snipy7374 commented Sep 24, 2023

Summary

Adds docstrings for the following properties:

.description (added to InvokableSlashCommand and SubCommand)
.options (added to InvokableSlashCommand)

additionally i feel like we should document some attributes of the Option class, the reference fo SubCommand.description (which is Option.description) is already failing 'cause we're documenting only methods for the Option class

also why the API representation is called and documented as option in this class? https://docs.disnake.dev/en/stable/ext/commands/api/app_commands.html#disnake.ext.commands.SubCommand.option
shouldn't it be called body (which already exists) like other slash command classes?

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • 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, ...)

@shiftinv shiftinv added t: documentation Improvements or additions to documentation/examples s: needs review Issue/PR is awaiting reviews labels Sep 24, 2023
@shiftinv shiftinv added this to the disnake v2.10 milestone Sep 24, 2023
@shiftinv
Copy link
Member

additionally i feel like we should document some attributes of the Option class

Yup, otherwise CI will continue to fail. Option already has a list of parameters which mostly matches the list of attributes, so that section could be rewritten for this purpose.
In that case we should also consider turning this from Option() into Option to show the parameters in the signature.

shouldn't it be called body (which already exists) like other slash command classes?

it's aliased to that, I honestly don't remember if there was a reason for it - @EQUENOS might know

@EQUENOS
Copy link
Member

EQUENOS commented Oct 2, 2023

shouldn't it be called body (which already exists) like other slash command classes?

it's aliased to that, I honestly don't remember if there was a reason for it - @EQUENOS might know

It's called option because internally subcommands and groups are actually options with a special type, that's how discord API designed them. We added a body property for convenience, as it's useful in several places.

@Snipy7374 Snipy7374 changed the title docs: adds docstrings for some properties of InvokableSlashCommand and SubCommand docs: adds docstrings for some properties of InvokableSlashCommand and SubCommand and document Option's attributes Oct 11, 2023
@Snipy7374 Snipy7374 changed the title docs: adds docstrings for some properties of InvokableSlashCommand and SubCommand and document Option's attributes docs: adds docstrings for some properties of InvokableSlashCommand and SubCommand and document Option's attributes Oct 11, 2023
Copy link
Member

@shiftinv shiftinv left a comment

Choose a reason for hiding this comment

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

some minor nits - overall, this looks good to me

disnake/ext/commands/slash_core.py Outdated Show resolved Hide resolved
disnake/ext/commands/slash_core.py Outdated Show resolved Hide resolved
disnake/app_commands.py Outdated Show resolved Hide resolved
@Snipy7374 Snipy7374 requested a review from shiftinv November 12, 2023 22:01
Copy link
Member

@shiftinv shiftinv left a comment

Choose a reason for hiding this comment

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

lgtm!

disnake/ext/commands/slash_core.py Outdated Show resolved Hide resolved
disnake/ext/commands/slash_core.py Outdated Show resolved Hide resolved
disnake/ext/commands/slash_core.py Outdated Show resolved Hide resolved
@shiftinv shiftinv merged commit cc5db41 into DisnakeDev:master Nov 22, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: needs review Issue/PR is awaiting reviews t: documentation Improvements or additions to documentation/examples
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants