From 5c46f812c7b198b24ed00b77baf2dd117277ddb4 Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Mon, 20 Nov 2023 00:52:12 +0100 Subject: [PATCH] Document type property and classmethods for SelectDefaultValueType --- discord/components.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/discord/components.py b/discord/components.py index 297f815fe..dca22e8be 100644 --- a/discord/components.py +++ b/discord/components.py @@ -547,6 +547,7 @@ class SelectDefaultValue: @property def type(self) -> SelectDefaultValueType: + """:class:`SelectDefaultValueType`: The type of value that ``id`` represents.""" return self._type @type.setter @@ -574,6 +575,18 @@ class SelectDefaultValue: @classmethod def from_channel(cls, channel: Snowflake, /) -> Self: + """Creates a :class:`SelectDefaultValue` with the type set to :attr:`~SelectDefaultValueType.channel`. + + Parameters + ----------- + channel: :class:`~discord.abc.Snowflake` + The channel to create the default value for. + + Returns + -------- + :class:`SelectDefaultValue` + The default value created with the channel. + """ return cls( id=channel.id, type=SelectDefaultValueType.channel, @@ -581,6 +594,18 @@ class SelectDefaultValue: @classmethod def from_role(cls, role: Snowflake, /) -> Self: + """Creates a :class:`SelectDefaultValue` with the type set to :attr:`~SelectDefaultValueType.role`. + + Parameters + ----------- + role: :class:`~discord.abc.Snowflake` + The role to create the default value for. + + Returns + -------- + :class:`SelectDefaultValue` + The default value created with the role. + """ return cls( id=role.id, type=SelectDefaultValueType.role, @@ -588,6 +613,18 @@ class SelectDefaultValue: @classmethod def from_user(cls, user: Snowflake, /) -> Self: + """Creates a :class:`SelectDefaultValue` with the type set to :attr:`~SelectDefaultValueType.user`. + + Parameters + ----------- + user: :class:`~discord.abc.Snowflake` + The user to create the default value for. + + Returns + -------- + :class:`SelectDefaultValue` + The default value created with the user. + """ return cls( id=user.id, type=SelectDefaultValueType.user,