mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +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
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user