Skip to content

Conversation

@Enegg
Copy link
Contributor

@Enegg Enegg commented Nov 6, 2025

Summary

  • adds a Raises docstring section to ui.button and ui.*_select decorators
  • unifies the description of the .id attribute of components. This includes:
    • adding the "This is always present in components received from the API." part to ui/ members
    • changing the text "unique within message" to "unique within modal" for modal-specific components, and "unique within view" for the decorators
    • mentioning the behavior of id=0 for components/ members

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 uv run nox -s lint
    • I have type-checked the code by running uv run nox -s 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, ...)

@read-the-docs-community
Copy link

read-the-docs-community bot commented Nov 6, 2025

Documentation build overview

📚 disnake | 🛠️ Build #30248579 | 📁 Comparing b7da028 against latest (d231d63)


🔍 Preview build

Show files changed (49 files in total): 📝 49 modified | ➕ 0 added | ➖ 0 deleted
File Status
genindex.html 📝 modified
index.html 📝 modified
whats_new.html 📝 modified
api/abc.html 📝 modified
api/activities.html 📝 modified
api/app_commands.html 📝 modified
api/app_info.html 📝 modified
api/audit_logs.html 📝 modified
api/automod.html 📝 modified
api/channels.html 📝 modified
api/clients.html 📝 modified
api/components.html 📝 modified
api/emoji.html 📝 modified
api/entitlements.html 📝 modified
api/events.html 📝 modified
api/exceptions.html 📝 modified
api/guild_scheduled_events.html 📝 modified
api/guilds.html 📝 modified
api/integrations.html 📝 modified
api/interactions.html 📝 modified
api/invites.html 📝 modified
api/localization.html 📝 modified
api/members.html 📝 modified
api/messages.html 📝 modified
api/misc.html 📝 modified
api/permissions.html 📝 modified
api/roles.html 📝 modified
api/skus.html 📝 modified
api/soundboard.html 📝 modified
api/stage_instances.html 📝 modified
api/stickers.html 📝 modified
api/subscriptions.html 📝 modified
api/ui.html 📝 modified
api/users.html 📝 modified
api/utilities.html 📝 modified
api/voice.html 📝 modified
api/webhooks.html 📝 modified
api/widgets.html 📝 modified
ext/tasks/index.html 📝 modified
ext/commands/api/app_commands.html 📝 modified
ext/commands/api/bots.html 📝 modified
ext/commands/api/checks.html 📝 modified
ext/commands/api/cogs.html 📝 modified
ext/commands/api/context.html 📝 modified
ext/commands/api/converters.html 📝 modified
ext/commands/api/exceptions.html 📝 modified
ext/commands/api/help_commands.html 📝 modified
ext/commands/api/misc.html 📝 modified
ext/commands/api/prefix_commands.html 📝 modified

@Enegg
Copy link
Contributor Author

Enegg commented Nov 6, 2025

Hmm, about the .id "parameter", after reading the resulting docs I now see that for components/ it appears in the attribute section instead, in which case

mentioning the behavior of id=0 for components/ members

doesn't make that much sense

@Enegg Enegg changed the title docs: Unify description of components' .id attribute; add Raises section to ui.button/ui.*_select decorators docs: Unify description of components' .id attribute; add Raises section to @ui.button()/@ui.*_select() Nov 6, 2025
Comment on lines 359 to 362
TypeError
The decorated function was not a coroutine function,
the ``cls`` parameter was not a callable or a subclass of :class:`Button`,
or an invalid value for the ``emoji`` parameter was passed.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this. There are no issubclass checks on cls anymore, and the emoji value check technically happens at a later point on View instantiation, not immediately, it's kind of tough to document that properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are no issubclass checks on cls anymore

That is true; I deliberately left it in, as to say that a subclass would work here

[off-scope] We could re-introduce the subclass checks, by doing

if not callable(cls) or (isinstance(cls, type) and not issubclass(cls, Button)): ...

the emoji value check technically happens at a later point on View instantiation, not immediately, it's kind of tough to document that properly.

Yea, what we want to say is that passing incorrect value for emoji will result in an exception at a later point.

@shiftinv
Copy link
Member

shiftinv commented Nov 8, 2025

Hmm, about the .id "parameter", after reading the resulting docs I now see that for components/ it appears in the attribute section instead, in which case

mentioning the behavior of id=0 for components/ members

doesn't make that much sense

I wanna say that's fine, many classes don't usually have attributes and parameters documented for brevity when they're (near) identical, otherwise there'd be a lot of copy-pasting the same list of field over and over again.

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.

2 participants