mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-06 10:02:01 +00:00
Document type property and classmethods for SelectDefaultValueType
This commit is contained in:
parent
a5d03d4a1e
commit
5c46f812c7
@ -547,6 +547,7 @@ class SelectDefaultValue:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self) -> SelectDefaultValueType:
|
def type(self) -> SelectDefaultValueType:
|
||||||
|
""":class:`SelectDefaultValueType`: The type of value that ``id`` represents."""
|
||||||
return self._type
|
return self._type
|
||||||
|
|
||||||
@type.setter
|
@type.setter
|
||||||
@ -574,6 +575,18 @@ class SelectDefaultValue:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_channel(cls, channel: Snowflake, /) -> Self:
|
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(
|
return cls(
|
||||||
id=channel.id,
|
id=channel.id,
|
||||||
type=SelectDefaultValueType.channel,
|
type=SelectDefaultValueType.channel,
|
||||||
@ -581,6 +594,18 @@ class SelectDefaultValue:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_role(cls, role: Snowflake, /) -> Self:
|
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(
|
return cls(
|
||||||
id=role.id,
|
id=role.id,
|
||||||
type=SelectDefaultValueType.role,
|
type=SelectDefaultValueType.role,
|
||||||
@ -588,6 +613,18 @@ class SelectDefaultValue:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_user(cls, user: Snowflake, /) -> Self:
|
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(
|
return cls(
|
||||||
id=user.id,
|
id=user.id,
|
||||||
type=SelectDefaultValueType.user,
|
type=SelectDefaultValueType.user,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user