discord-interactions

Component Models

class interactions.models.component.SelectOption(**kwargs)

A class object representing the select option of a select menu.

Variables
  • _json (dict) – The dictionary representation of the object.

  • label (str) – The label of the select option.

  • value (str) – The returned value of the select option.

  • description (typing.Optional[str]) – The description of the select option.

  • emoji (typing.Optional[interactions.api.models.message.Emoji]) – The emoji used alongside the label of the select option.

  • default (typing.Optional[bool]) – Whether the select option is the default for the select menu.

class interactions.models.component.SelectMenu(**kwargs)

A class object representing the select menu of a component.

Variables
  • _json (dict) – The dictionary representation of the object.

  • type (interactions.enums.ComponentType) – The type of select menu.

  • custom_id (str) – The customized “ID” of the select menu.

  • options (typing.List[interactions.models.component.SelectOption]) – The list of select options in the select menu.

  • placeholder (typing.Optional[str]) – The placeholder of the select menu.

  • min_values (typing.Optional[int]) – The minimum “options”/values to choose from the component.

  • max_values (typing.Optional[int]) – The maximum “options”/values to choose from the component.

  • disabled (typing.Optional[bool]) – Whether the select menu is unable to be used.

class interactions.models.component.ActionRow(**kwargs)
class interactions.models.component.Button(**kwargs)

A class object representing the button of a component.

Variables
  • _json (dict) – The dictionary representation of the object.

  • type (interactions.enums.ButtonType) – The type of button.

  • style (interactions.enums.ButtonType) – The style of the button.

  • label (str) – The label of the button.

  • emoji (typing.Optional[interactions.api.models.message.Emoji]) – The emoji used alongside the laebl of the button.

  • custom_id (typing.Optional[str]) – The customized “ID” of the button.

  • url (typing.Optional[str]) – The URL route/path of the button.

  • disabled (typing.Optional[bool]) – Whether the button is unable to be used.

class interactions.models.component.Component(**kwargs)

A class object representing the component in an interaction response/followup.

Note

components is only applicable if an ActionRow is supported, otherwise ActionRow-less will be opted. list is in reference to the class.

Variables
  • _json (dict) – The dictionary representation of the object.

  • type (typing.Union[interactions.models.ActionRow, interactions.models.Button, interactions.models.Menu]) – The type of component.

  • custom_id (typing.Optional[str]) – The customized “ID” of the component.

  • disabled (typing.Optional[bool]) – Whether the component is unable to be used.

  • style (typing.Optional[interactions.enums.ButtonType]) – The style of the component.

  • label (typing.Optional[str]) – The label of the component.

  • emoji (typing.Optional[interactions.api.models.message.Emoji]) – The emoji used alongside the label of the component.

  • url (typing.Optional[str]) – The URl route/path of the component.

  • options (typing.Optional[typing.List[interactions.models.Menu]]) – The “choices”/options of the component.

  • placeholder (typing.Optional[str]) – The placeholder text/value of the component.

  • min_values (typing.Optional[int]) – The minimum “options”/values to choose from the component.

  • max_values (typing.Optional[int]) – The maximum “options”/values to choose from the component.

  • components (typing.Optional[typing.Union[list, interactions.models.ActionRow, typing.List[interactions.models.ActionRow]]]) – A list of components nested in the component.