Source code for discord.components.default_select_option
"""The MIT License (MIT)Copyright (c) 2021-present Pycord DevelopmentPermission is hereby granted, free of charge, to any person obtaining acopy of this software and associated documentation files (the "Software"),to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, and to permit persons to whom theSoftware is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHERDEALINGS IN THE SOFTWARE."""from__future__importannotationsfromtypingimportGenericfromtyping_extensionsimportoverridefrom..types.component_typesimportSelectDefaultValuefrom.typesimportDT
[docs]classDefaultSelectOption(Generic[DT]):""" Represents a default select menu option. Can only be used :class:`UserSelect`, :class:`RoleSelect`, and :class:`MentionableSelect`. .. versionadded:: 3.0 Attributes ---------- id: :class:`int` The ID of the default option. type: :class:`str` The type of the default option. This can be either "user", "role", or "channel". This is used to determine which type of select menu this option belongs to. Parameters ---------- id: The ID of the default option. type: The type of the default option. This can be either "user", "role", or "channel". """__slots__:tuple[str,...]=("id","type")def__init__(self,id:int,type:DT,)->None:self.id:int=idself.type:DT=type@overridedef__repr__(self)->str:returnf"<DefaultSelectOption id={self.id!r} type={self.type!r}>"
[docs]@classmethoddeffrom_payload(cls,payload:SelectDefaultValue[DT])->DefaultSelectOption[DT]:"""Creates a DefaultSelectOption from a dictionary."""returncls(id=payload["id"],type=payload["type"],)
[docs]defto_dict(self)->SelectDefaultValue[DT]:"""Converts the DefaultSelectOption to a dictionary."""return{"id":self.id,"type":self.type,}