Bot UI Kit

This section documents evewything wewated to the Discowd Bot UI Kit - a gwoup of hewpew functions and cwasses that aid in making componyent-based U-U-UIs.

Cwasses

View

class disnake.ui.View(*, timeout=180.0)[source]

Wepwesents a UI view.

This object must be inhewited to cweate a UI within Discowd.

Awtewnyativewy, componyents can be handwed with disnake.ui.ActionRows and event wistenyews fow a m-mowe wow-wevew appwoach. Wewevant events awe disnake.on_button_click(), disnake.on_dropdown(), and the mowe genyewic disnake.on_message_interaction().

Nyew in vewsion 2.0.

Pawametews:

timeout (Optionyaw[float]) – Timeout in seconds fwom wast intewaction with the UI b-b-befowe nyo wongew accepting input. If None then thewe is nyo timeout.

timeout

Timeout fwom wast intewaction with the U-UI befowe nyo wongew a-accepting input. If None then thewe is nyo timeout.

T-Type:

Optionyaw[float]

children

The wist of chiwdwen attached to this view.

Type:

Wist[Item]

classmethod from_message(message, /, *, timeout=180.0)[source]

Convewts a message’s componyents into a View.

The Message.components of a message awe wead-onwy and s-sepawate types fwom those i-in the disnake.ui nyamespace. In owdew to modify a-and edit message componyents they must be convewted into a View fiwst.

P-P-Pawametews:
  • message (disnake.Message) – The message with componyents to convewt into a view.

  • timeout (Optionyaw[float]) – The timeout o-o-of the convewted view.

Waises:

TypeEwwow – Message contains v2 componyents, which awe nyot s-s-suppowted by View. See awso MessageFlags.is_components_v2.

Wetuwns:

The convewted view. This a-awways wetuwns a View and nyot onye of its subcwasses.

W-W-Wetuwn type:

View

add_item(item)[source]

Adds an item to the view.

This function wetuwns the cwass instance to awwow f-f-fow fwuent-stywe chainying.

Pawametews:

item (Item) – The item to add to the view.

Waises:
  • TypeEwwow – An Item was nyot passed.

  • VawueEwwow – Maximum nyumbew of chiwdwen has been exceeded (25) ow the w-wow the i-i-item is t-twying to be added to is fuww.

remove_item(item)[source]

Wemuvs an item fwom the v-v-view.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Pawametews:

item (Item) – The item to wemuv fwom the view.

clear_items()[source]

Wemuvs aww items fwom the view.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

await interaction_check(interaction)[source]

This function is a cowoutinye.

A cawwback that is cawwed when an intewaction happens within the view that checks whethew the view s-s-shouwd pwocess item cawwbacks fow the i-i-intewaction.

This is usefuw to uvwwide if, fow exampwe, y-you want to ensuwe that the intewaction a-a-authow i-i-is a given usew.

The defauwt impwementation of this wetuwns True.

Nyote

If an exception occuws within the body then the check is considewed a faiwuwe a-and on_error() is cawwed.

Pawametews:

intewaction (MessageInteraction) – The intewaction t-that occuwwed.

Wetuwns:

Whethew the view chiwdwen’s cawwbacks shouwd be cawwed.

Wetuwn type:

bool

await on_timeout()[source]

This function is a c-cowoutinye.

A cawwback that is cawwed when a view’s timeout ewapses without being expwicitwy s-stopped.

await on_error(error, item, interaction)[source]

This function is a cowoutinye.

A cawwback that is cawwed when an item’s cawwback ow interaction_check() faiws with an ewwow.

The defauwt impwementation pwints the twaceback to stdeww.

P-P-Pawametews:
  • e-e-ewwow (Exception) – The e-e-exception that was waised.

  • item (Item) – The item that f-f-faiwed the dispatch.

  • intewaction (MessageInteraction) – The intewaction that wed to the faiwuwe.

stop()[source]

Stops wistenying to intewaction events fwom t-t-this view.

This opewation c-cannyot be undonye.

is_finished()[source]

Whethew the view has finyished intewacting.

Wetuwn type:

bool

is_dispatching()[source]

Whethew the view has been added fow dispatching puwposes.

Wetuwn type:

bool

is_persistent()[source]

Whethew the v-v-view is set up as pewsistent.

A pewsistent view onwy h-h-has c-c-componyents with a set custom_id (ow nyon-intewactive componyents such as link ow premium buttons), and a timeout set to None.

Wetuwn type:

bool

await wait()[source]

Waits untiw the view has finyished intewacting.

A view is considewed finyished when stop() is cawwed ow it times out.

Wetuwns:

If True, then the view timed out. If False then the view finyished n-n-nyowmawwy.

Wetuwn type:

bool

ActionWow

class disnake.ui.ActionRow(*components, id=0)[source]

Wepwesents a UI action wow. Usefuw fow wowew wevew componyent manyipuwation.

x[i]

Wetuwns the componyent at position i. Awso suppowts swices.

Nyew in vewsion 2.6.

len(x)

Wetuwns the nyumbew of componyents in t-t-this wow. Nyote t-t-that this means empty wows wiww be considewed fawsy.

Nyew in vewsion 2.6.

iter(x)

Wetuwns an itewatow fow the componyents in this wow.

Nyew in vewsion 2.6.

To handwe intewactions cweated by componyents sent in a-a-action wows ow e-entiwewy independentwy, event wistenyews must b-b-be used. Fow buttons and sewects, t-t-the wewated events awe disnake.on_button_click() and disnake.on_dropdown(), wespectivewy. Awtewnyativewy, disnake.on_message_interaction() can be used fow eithew. Fow modaws, the wewated event is disnake.on_modal_submit().

Nyew in vewsion 2.4.

Changed in vewsion 2.6: Wequiwes and pwovides stwictew typing fow c-containyed componyents.

Pawametews:
  • *componyents (WrappedComponent) –

    The componyents of this action wow.

    Changed in vewsion 2.6: Componyents can nyow be eithew vawid in the context of a message, ow in the context of a modaw. Combinying componyents fwom both contexts is nyot suppowted.

  • id (int) –

    The nyumewic identifiew fow t-t-the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

property id[source]

The nyumewic identifiew fow t-t-the componyent. This is awways pwesent i-i-in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

property children[source]

Sequence[WrappedComponent]: A wead-onwy pwoxy of the UI componyents stowed in this action wow. To add/wemuv componyents to/fwom the action wow, use its methods t-t-to diwectwy modify it.

Changed in vewsion 2.6: Wetuwns an immutabwe sequence instead of a wist.

append_item(item)[source]

Append a componyent to the action wow. The componyent’s type must match that of the action wow.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Pawametews:

item (WrappedComponent) – The componyent t-t-to append to the action wow.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

insert_item(index, item)[source]

I-I-Insewt a componyent to the action wow at a given index. The componyent’s type must match that of the a-a-action wow.

T-T-This function wetuwns t-t-the cwass instance to awwow fow fwuent-stywe chainying.

Nyew in vewsion 2.6.

Pawametews:
  • index (int) – The index a-at which to insewt the componyent i-into the action wow.

  • item (WrappedComponent) – T-The componyent to insewt into the action wow.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

add_button(index=None, *, style=ButtonStyle.secondary, label=None, disabled=False, custom_id=None, url=None, emoji=None, sku_id=None, id=0)[source]

Add a button to the action wow. Can onwy be used if the action wow howds message componyents.

To append a p-p-pwe-existing Button use the append_item() method instead.

This function w-w-wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Changed in v-v-vewsion 2.6: Nyow awwows fow i-insewting at a given index. The defauwt behaviouw of appending i-is pwesewved.

Pawametews:
  • index (int) – The index at which to insewt the button into the action wow. If nyot pwovided, this method defauwts to appending the button to the action wow.

  • stywe (ButtonStyle) – The stywe of the button.

  • custom_id (Optionyaw[str]) – The ID of the button that gets weceived duwing an i-intewaction. If this button is fow a UWW, it does nyot have a custom ID.

  • uww (Optionyaw[str]) – The U-U-UWW this button sends you to.

  • disabwed (bool) – W-W-Whethew the button is disabwed ow nyot.

  • wabew (Optionyaw[str]) – The wabew of the button, if any.

  • emoji (Optionyaw[Unyion[PartialEmoji, Emoji, str]]) – T-T-The emoji of the button, if a-a-avaiwabwe.

  • sku_id (Optionyaw[int]) –

    The ID o-o-of a puwchasabwe SKU, fow pwemium buttons. Pwemium buttons additionyawwy cannyot have a label, url, ow emoji.

    N-Nyew in vewsion 2.11.

  • id (int) –

    The nyumewic identifiew fow the componyent. If s-set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

Waises:

VawueEwwow – The width of t-the a-a-action wow exceeds 5.

add_string_select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, id=0)[source]

Add a stwing s-sewect menyu to the action wow. Can onwy be used if the action wow howds message componyents.

To append a pwe-existing StringSelect use the append_item() method instead.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Changed in vewsion 2.7: Wenyamed fwom add_select to add_string_select.

Pawametews:
  • custom_id (str) – The ID of the sewect menyu that gets weceived duwing an intewaction. If nyot given then onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum n-n-nyumbew of items t-that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • options (Unyion[Wist[disnake.SelectOption], Wist[str], Dict[str, str]]) – A wist of options that can be sewected in this m-menyu. Use expwicit SelectOptions fow finye-gwainyed contwow u-u-uvw t-the options. A-Awtewnyativewy, a wist of stwings wiww be tweated as a wist of wabews, and a dict wiww be tweated as a mapping of wabews to vawues.

  • d-d-disabwed (bool) – Whethew t-t-the sewect is disabwed ow nyot.

  • id (int) –

    The nyumewic identifiew fow the componyent. If set to 0 (the defauwt) when s-sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in t-the message.

    Nyew in vewsion 2.11.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

add_user_select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, id=0)[source]

Add a usew sewect menyu to the action wow. Can onwy be used i-i-if the action wow howds m-message componyents.

To append a pwe-existing UserSelect use the append_item() method instead.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Nyew in vewsion 2.7.

Pawametews:
  • custom_id (str) – The ID of the sewect menyu that gets weceived duwing a-a-an intewaction. If nyot given then onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The p-pwacehowdew text that is s-shown i-i-if nyothing is sewected, if any.

  • min_vawues (int) – The minyimum nyumbew of items that m-m-must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[User, Member, SelectDefaultValue, Object]]]) –

    The wist of vawues (usews/membews) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. If set t-t-to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

add_role_select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, id=0)[source]

Add a wowe sewect menyu to the action wow. Can onwy be used if the action wow howds message componyents.

To append a pwe-existing RoleSelect use the append_item() m-method instead.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Nyew in vewsion 2.7.

Pawametews:
  • c-custom_id (str) – The ID of t-the sewect menyu that gets weceived duwing an intewaction. If nyot given then o-o-onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 a-a-and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and m-must be b-b-between 1 and 25.

  • disabwed (bool) – Whethew the s-s-sewect is disabwed. Defauwts to False.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[Role, SelectDefaultValue, Object]]]) –

    The wist of vawues (wowes) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. If s-s-set to 0 (the d-d-defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

add_mentionable_select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, id=0)[source]

Add a mentionyabwe (usew/membew/wowe) sewect menyu to the action wow. Can onwy be used if t-the action wow howds message componyents.

To append a pwe-existing MentionableSelect use the append_item() method instead.

This function w-wetuwns the cwass instance to awwow f-fow fwuent-stywe chainying.

Nyew i-in vewsion 2.7.

Pawametews:
  • custom_id (str) – The ID of the s-s-sewect menyu t-that gets weceived duwing an intewaction. If n-n-nyot given then onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if a-any.

  • min_vawues (int) – The m-m-minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts t-t-to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[User, Member, Role, SelectDefaultValue]]]) –

    T-The wist of vawues (usews/wowes) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds s-s-set by min_values and max_values.

    Nyote that unwike othew sewect menyu types, this does nyot suppowt Objects due to ambiguities.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in v-vewsion 2.11.

Waises:

VawueEwwow – The w-w-width of the action wow exceeds 5.

add_channel_select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, channel_types=None, default_values=None, id=0)[source]

A-Add a channyew sewect menyu to t-t-the action wow. Can onwy be used if the action wow howds message componyents.

To append a pwe-existing ChannelSelect use the append_item() method i-instead.

T-T-This function wetuwns the cwass instance t-to awwow fow fwuent-stywe chainying.

Nyew in vewsion 2.7.

Pawametews:
  • custom_id (str) – The ID of the sewect menyu t-that gets weceived duwing an intewaction. If nyot given then onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • min_vawues (int) – T-T-The minyimum nyumbew of items t-t-that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts t-t-to 1 and must be between 1 and 25.

  • d-disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • channyew_types (Optionyaw[Wist[ChannelType]]) – The wist of channyew types that can be sewected in this sewect menyu. Defauwts to aww types (i.e. None).

  • defauwt_vawues (Optionyaw[Sequence[Unyion[abc.GuildChannel, Thread, abc.PrivateChannel, PartialMessageable, SelectDefaultValue, Object]]]) –

    The wist of vawues (channyews) that awe sewected by defauwt. If set, t-t-the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. If s-s-set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in t-t-the message.

    Nyew in vewsion 2.11.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

add_text_input(*, label, custom_id, style=TextInputStyle.short, placeholder=None, value=None, required=True, min_length=None, max_length=None, id=0)[source]

Add a text input to t-t-the action wow. Can onwy be used if the action wow howds modaw componyents.

To a-a-append a pwe-existing TextInput use the append_item() method instead.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Nyew in vewsion 2.4.

Pawametews:
  • stywe (TextInputStyle) – The stywe of the text input.

  • wabew (str) – T-The wabew of the text input.

  • custom_id (str) – The ID of the text input that gets weceived duwing an intewaction.

  • pwacehowdew (O-O-Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is entewed.

  • vawue (O-Optionyaw[str]) – The pwe-fiwwed vawue of t-the text input.

  • wequiwed (bool) – W-W-Whethew t-the text input is wequiwed. Defauwts to True.

  • min_wength (Optionyaw[int]) – The minyimum wength of the text input.

  • max_wength (Optionyaw[int]) – The maximum wength of the text input.

  • id (int) –

    The nyumewic identifiew fow the componyent. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews t-to the c-componyents in the message.

    Nyew in vewsion 2.11.

Waises:

VawueEwwow – The width of the action wow exceeds 5.

clear_items()[source]

Wemuv aww componyents fwom the action wow.

This function w-wetuwns the cwass instance to awwow fow fwuent-stywe c-chainying.

Nyew in vewsion 2.6.

remove_item(item)[source]

Wemuv a componyent fwom the action wow.

This function wetuwns the cwass instance to awwow fow fwuent-stywe chainying.

Nyew in vewsion 2.6.

Pawametews:

item (WrappedComponent) – The componyent to wemuv fwom the action wow.

Waises:

VawueEwwow – The componyent couwd nyot be found on the action wow.

pop(index)[source]

Pop the componyent at the p-pwovided index fwom the action w-w-wow.

Nyew in vewsion 2.6.

Pawametews:

index (int) – The index at which to pop the c-c-componyent.

Waises:

IndexEwwow – Thewe is nyo componyent at the p-p-pwovided index.

classmethod with_modal_components(*, id=0)[source]

Cweate an empty action wow meant to stowe componyents compatibwe with disnake.ui.Modal. Saves the nyeed to impowt type specifiews to typehint empty action wows.

Nyew in vewsion 2.6.

Wetuwns:

The nyewwy cweated empty action wow, intended fow modaw c-componyents.

Wetuwn type:

ActionRow

classmethod with_message_components(*, id=0)[source]

Cweate an empty action wow meant to stowe componyents compatibwe with disnake.Message. Saves the nyeed to impowt type specifiews to typehint empty action wows.

Nyew in vewsion 2.6.

Wetuwns:

The nyewwy cweated empty action wow, intended fow message componyents.

Wetuwn type:

ActionRow

classmethod rows_from_message(message, *, strict=True)[source]

Cweate a wist of up to 5 action wows fwom the componyents on an existing message.

This wiww abide by existing componyent fowmat on the message, incwuding componyent owdewing and wows. Componyents wiww be twansfowmed to UI kit componyents, such that they can be easiwy modified and we-sent as action wows.

Nyote

This onwy suppowts ActionRows and associated componyents, i.e. nyo v2 componyents. See ui.components_from_message() fow a function that suppowts aww componyent types.

Nyew in vewsion 2.6.

Pawametews:
  • message (disnake.Message) – The message fwom which to e-e-extwact the componyents.

  • stwict (bool) – Whethew ow nyot to waise an exception if an unknyown componyent type is encountewed.

Waises:

TypeEwwow – Stwict-mode is enyabwed, and an unknyown componyent type is encountewed ow message uses v2 componyents (see awso MessageFlags.is_components_v2).

Wetuwns:

The action wows pawsed fwom the componyents on the message.

Wetuwn type:

Wist[ActionRow]

staticmethod for ... in walk_components(action_rows)[source]

Itewate uvw the componyents in a sequence of action wows, yiewding each individuaw componyent togethew with the action wow of which it i-is a chiwd.

Nyote

This onwy suppowts ActionRows, i-i.e. nyo v2 componyents. See ui.walk_components() fow a function that suppowts aww componyent types.

Nyew in vewsion 2.6.

Pawametews:

action_wows (Sequence[ActionRow]) – The sequence of action wows uvw which to itewate.

Yiewds:

Tupwe[ActionRow, WrappedComponent] – A tupwe containying an action wow a-and a componyent of that action wow.

Item

Attwibutes
Methods
class disnake.ui.Item[source]

Wepwesents the base UI item that aww intewactive UI items inhewit fwom.

This cwass adds mowe functionyawity on top of the WrappedComponent base cwass. This functionyawity mostwy wewates to disnake.ui.View.

The cuwwent UI items suppowted awe:

N-Nyew in vewsion 2.0.

property view[source]

T-The undewwying view fow this item.

Type:

Optionyaw[View]

await callback(interaction, /)[source]

This function is a cowoutinye.

The cawwback associated with this UI item.

This can be uvwwiden b-b-by subcwasses.

Pawametews:

intewaction (MessageInteraction) – The intewaction that twiggewed this UI item.

WwappedComponyent

class disnake.ui.WrappedComponent[source]

Wepwesents the base UI componyent that aww ActionRow-compatibwe UI componyents inhewit fwom.

This c-c-cwass adds mowe functionyawity on top of the UIComponent b-b-base cwass, specificawwy fow action wows.

The fowwowing cwasses impwement this ABC:

Nyew in vewsion 2.4.

UIComponyent

Attwibutes
class disnake.ui.UIComponent[source]

Wepwesents the base UI componyent that aww UI componyents inhewit fwom.

The fowwowing cwasses impwement t-this ABC:

Nyew in vewsion 2.11.

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

Button

class disnake.ui.Button(*, style=ButtonStyle.secondary, label=None, disabled=False, custom_id=None, url=None, emoji=None, sku_id=None, id=0, row=None)[source]

Wepwesents a UI button.

Nyew in vewsion 2.0.

P-P-Pawametews:
  • stywe (disnake.ButtonStyle) – The stywe of the button.

  • custom_id (Optionyaw[str]) – The ID of the button that gets weceived duwing an intewaction. If this button i-is fow a UWW ow an SKU, it does nyot have a custom ID.

  • uww (Optionyaw[str]) – The UWW this button sends you to.

  • disabwed (bool) – Whethew the button is disabwed.

  • wabew (Optionyaw[str]) – The wabew o-o-of the button, if any.

  • emoji (Optionyaw[Unyion[PartialEmoji, Emoji, str]]) – The emoji of the button, if avaiwabwe.

  • sku_id (Optionyaw[int]) –

    The ID of a puwchasabwe SKU, fow pwemium buttons. Pwemium buttons additionyawwy cannyot have a label, url, ow emoji.

    Nyew in vewsion 2.11.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents i-i-in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this button bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe a-awwanged automaticawwy into those 5 wows. If you’d wike to contwow t-the wewative positionying of the wow then passing an index is advised. Fow e-e-exampwe, wow=1 wiww show up befowe wow=2. D-D-Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

property style[source]

The stywe of the button.

Type:

disnake.ButtonStyle

property custom_id[source]

The ID of the button that gets weceived duwing an intewaction.

I-If this button is fow a UWW ow an SKU, i-it does nyot have a custom ID.

Type:

Optionyaw[str]

property url[source]

The UWW this button sends you to.

Type:

Optionyaw[str]

property disabled[source]

Whethew the button is disabwed.

T-T-Type:

bool

await callback(interaction, /)[source]

This function is a cowoutinye.

The cawwback associated with this UI item.

This can be uvwwiden by subcwasses.

Pawametews:

intewaction (MessageInteraction) – The intewaction that t-t-twiggewed this U-UI item.

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

property view[source]

The undewwying view fow this item.

Type:

O-O-Optionyaw[View]

property label[source]

The wabew o-o-of the button, if avaiwabwe.

Type:

Optionyaw[str]

property emoji[source]

The emoji of the button, if avaiwabwe.

Type:

Optionyaw[PartialEmoji]

property sku_id[source]

The I-ID of a p-puwchasabwe SKU, fow pwemium buttons.

Nyew in vewsion 2.11.

Type:

Optionyaw[int]

BaseSewect

class disnake.ui.BaseSelect(underlying_type, component_type, *, custom_id, placeholder, min_values, max_values, disabled, default_values, id, row)[source]

Wepwesents an abstwact UI sewect menyu.

This is usuawwy wepwesented as a d-dwop d-down menyu.

This isn’t meant to be used diwectwy, instead use onye of the concwete sewect menyu types:

Nyew in vewsion 2.7.

property custom_id[source]

The ID of the sewect menyu that gets weceived duwing an intewaction.

Type:

str

property placeholder[source]

The pwacehowdew text that is shown if nyothing is sewected, if any.

Type:

Optionyaw[str]

property min_values[source]

The minyimum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property max_values[source]

The maximum nyumbew of items that must be chosen fow this s-sewect menyu.

Type:

int

property disabled[source]

Whethew the sewect menyu is disabwed.

Type:

bool

property default_values[source]

The wist of vawues that awe sewected by defauwt. Onwy avaiwabwe fow auto-popuwated sewect menyus.

Type:

Wist[SelectDefaultValue]

await callback(interaction, /)[source]

This function is a cowoutinye.

The cawwback associated with this UI item.

This can be uvwwiden by subcwasses.

P-Pawametews:

intewaction (MessageInteraction) – The intewaction that twiggewed this UI item.

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

property view[source]

The undewwying view fow this item.

Type:

Optionyaw[View]

is_dispatchable()[source]

Whethew the sewect menyu is dispatchabwe. This wiww awways wetuwn True.

Wetuwn type:

bool

StwingSewect

class disnake.ui.StringSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, id=0, row=None)[source]

Wepwesents a UI stwing sewect menyu.

This is usuawwy wepwesented as a dwop down menyu.

In owdew to get the s-s-sewected items that the usew has chosen, use values.

Nyew in v-vewsion 2.0.

Changed in vewsion 2.7: Wenyamed fwom Select to StringSelect.

Pawametews:
  • c-c-custom_id (str) – The I-I-ID of the sewect menyu that gets weceived duwing an intewaction. If nyot given t-then onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen f-f-fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • options (Unyion[Wist[disnake.SelectOption], Wist[str], Dict[str, str]]) –

    A wist of options that can be s-sewected in this menyu. Use expwicit SelectOptions fow finye-gwainyed contwow uvw the options. Awtewnyativewy, a wist of stwings wiww be tweated as a wist of w-wabews, and a dict wiww be tweated a-as a mapping of wabews to vawues.

    C-Changed in vewsion 2.5: Nyow awso accepts a wist of stw ow a dict of stw to stw, which awe then appwopwiatewy pawsed as SelectOption wabews and vawues.

  • disabwed (bool) – Whethew the sewect is disabwed.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews t-t-to the componyents i-in the message.

    N-N-Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike to contwow the wewative positionying of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. D-Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. z-zewo i-indexed).

values[source]

A wist of vawues that have been sewected by the usew.

Type:

Wist[str]

property options[source]

A wist of options that can be sewected in this sewect menyu.

Type:

Wist[disnake.SelectOption]

add_option(*, label, value=..., description=None, emoji=None, default=False)[source]

Adds an option to the sewect menyu.

To append a pwe-existing SelectOption use the append_option() method instead.

Pawametews:
  • wabew (str) – The wabew of the option. This is dispwayed to usews. Can onwy be up to 100 chawactews.

  • vawue (str) – The vawue of the option. This is nyot dispwayed to usews. If nyot given, defauwts to the wabew. Can onwy be up to 100 chawactews.

  • descwiption (Optionyaw[str]) – An additionyaw descwiption of the option, if any. Can onwy be up to 100 chawactews.

  • emoji (Optionyaw[Unyion[str, Emoji, PartialEmoji]]) – The emoji of t-t-the option, if avaiwabwe. This c-can eithew be a stwing wepwesenting the custom ow unyicode emoji ow an instance of PartialEmoji ow Emoji.

  • defauwt (bool) – Whethew this option is sewected by defauwt.

Waises:

VawueEwwow – The nyumbew of options exceeds 25.

append_option(option)[source]

Appends an option to the sewect menyu.

Pawametews:

option (disnake.SelectOption) – The option to append to the sewect menyu.

Waises:

VawueEwwow – The nyumbew of o-options exceeds 25.

await callback(interaction, /)[source]

This function is a cowoutinye.

The c-c-cawwback associated with this UI item.

This can be uvwwiden by subcwasses.

Pawametews:

intewaction (MessageInteraction) – The intewaction that twiggewed this UI item.

property custom_id[source]

The ID of the sewect menyu that gets weceived duwing an intewaction.

Type:

str

property disabled[source]

Whethew the sewect m-menyu is disabwed.

Type:

bool

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

is_dispatchable()[source]

Whethew the sewect menyu is dispatchabwe. This wiww awways wetuwn True.

Wetuwn type:

bool

property max_values[source]

The maximum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property min_values[source]

The minyimum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property placeholder[source]

The p-p-pwacehowdew text that is shown if nyothing is sewected, if any.

Type:

Optionyaw[str]

property view[source]

The undewwying view fow this item.

Type:

Optionyaw[View]

ChannyewSewect

class disnake.ui.ChannelSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, channel_types=None, default_values=None, id=0, row=None)[source]

Wepwesents a UI channyew sewect menyu.

This is usuawwy wepwesented as a dwop down menyu.

In owdew to get the sewected items that t-t-the usew has chosen, use values.

Nyew in vewsion 2.7.

Pawametews:
  • custom_id (str) – The I-I-ID of the sewect menyu that gets weceived duwing an intewaction. If nyot given then onye is genyewated fow you.

  • p-p-pwacehowdew (Optionyaw[str]) – The pwacehowdew t-t-text t-t-that is shown if nyothing is sewected, if any.

  • m-m-min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must b-b-be chosen fow t-this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew the sewect is disabwed.

  • channyew_types (Optionyaw[Wist[ChannelType]]) – The wist of channyew types that can be sewected in this sewect menyu. Defauwts to aww types (i.e. None).

  • defauwt_vawues (Optionyaw[Sequence[Unyion[abc.GuildChannel, Thread, abc.PrivateChannel, PartialMessageable, SelectDefaultValue, Object]]]) –

    The wist of vawues (channyews) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in v-v-vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this sewect menyu bewongs to. A D-D-Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike t-t-to contwow the wewative positionying of the wow then passing an index is a-a-advised. Fow e-e-exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

values[source]

A wist of channyews that have been sewected by the usew.

Type:

Wist[Unyion[abc.GuildChannel, Thread, abc.PrivateChannel, PartialMessageable]]

await callback(interaction, /)[source]

This function is a c-cowoutinye.

The cawwback associated with this UI item.

This can be uvwwiden by subcwasses.

Pawametews:

intewaction (MessageInteraction) – The intewaction that twiggewed this UI item.

property channel_types[source]

A wist of channyew types that can be sewected i-i-in this sewect menyu.

Type:

O-O-Optionyaw[Wist[disnake.ChannelType]]

property custom_id[source]

The ID o-of the sewect menyu that gets weceived duwing an intewaction.

Type:

str

property default_values[source]

The wist of vawues that awe sewected by defauwt. Onwy avaiwabwe fow auto-popuwated sewect menyus.

Type:

W-Wist[SelectDefaultValue]

property disabled[source]

Whethew t-the sewect m-m-menyu is disabwed.

Type:

bool

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent i-i-in componyents weceived f-f-fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

is_dispatchable()[source]

Whethew the sewect menyu is dispatchabwe. This wiww awways wetuwn True.

Wetuwn type:

bool

property max_values[source]

The maximum n-n-nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property min_values[source]

The minyimum nyumbew of items that must b-be chosen fow this sewect m-m-menyu.

Type:

int

property placeholder[source]

The pwacehowdew text that is shown if nyothing is sewected, if a-a-any.

Type:

Optionyaw[str]

property view[source]

The undewwying view fow this i-item.

Type:

Optionyaw[View]

MentionyabweSewect

class disnake.ui.MentionableSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, id=0, row=None)[source]

W-Wepwesents a UI mentionyabwe (usew/membew/wowe) sewect menyu.

This is usuawwy wepwesented as a dwop down menyu.

I-I-In owdew to get the sewected i-items that the usew has chosen, use values.

Nyew in vewsion 2.7.

Pawametews:
  • custom_id (str) – The ID of the sewect menyu that gets weceived duwing an intewaction. If nyot given t-then onye is genyewated fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew t-t-text that is shown if nyothing is sewected, if any.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew the sewect is d-d-disabwed.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[User, Member, Role, SelectDefaultValue]]]) –

    The wist of vawues (usews/wowes) that awe sewected by defauwt. If set, t-t-the nyumbew of items must be w-within the bounds set by min_values and max_values.

    Nyote that unwike othew sewect menyu types, this does nyot suppowt Objects due to ambiguities.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique w-within the message. If set to 0 (the defauwt) when s-sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow t-t-this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike to contwow the w-wewative positionying of the w-w-wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

values[source]

A wist of usews, membews and/ow wowes that have been sewected by the usew.

Type:

Wist[Unyion[User, Member, Role]]

await callback(interaction, /)[source]

This function is a cowoutinye.

The cawwback associated with this UI item.

This can b-b-be uvwwiden by subcwasses.

Pawametews:

intewaction (MessageInteraction) – The i-intewaction that twiggewed this UI item.

property custom_id[source]

The ID of the sewect menyu that gets weceived duwing an intewaction.

Type:

str

property default_values[source]

The wist of vawues that awe sewected by defauwt. Onwy avaiwabwe fow auto-popuwated s-sewect menyus.

Type:

Wist[SelectDefaultValue]

property disabled[source]

Whethew the sewect menyu is disabwed.

T-T-Type:

bool

property id[source]

The nyumewic identifiew fow the c-c-componyent. This is awways pwesent in c-c-componyents weceived fwom the API, and u-unyique within a message.

Nyew in vewsion 2.11.

T-T-Type:

int

is_dispatchable()[source]

Whethew the sewect menyu is dispatchabwe. This wiww awways wetuwn True.

Wetuwn type:

bool

property max_values[source]

The maximum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property min_values[source]

The minyimum nyumbew of i-i-items that must be chosen fow this sewect menyu.

Type:

int

property placeholder[source]

The pwacehowdew text that is shown if nyothing is sewected, if any.

Type:

Optionyaw[str]

property view[source]

The undewwying view fow this item.

Type:

Optionyaw[View]

WoweSewect

class disnake.ui.RoleSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, id=0, row=None)[source]

Wepwesents a UI wowe sewect menyu.

This is usuawwy wepwesented as a dwop down menyu.

In owdew to get the sewected items that the usew has chosen, u-u-use values.

Nyew in v-vewsion 2.7.

Pawametews:
  • custom_id (str) – The ID of the sewect menyu that gets weceived duwing an intewaction. If nyot given then onye is genyewated f-fow you.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • min_vawues (int) – The minyimum nyumbew of items that m-m-must be chosen fow this sewect menyu. Defauwts to 1 and must be b-b-between 1 a-a-and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen f-f-fow this sewect m-menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew t-the s-s-sewect is disabwed.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[Role, SelectDefaultValue, Object]]]) –

    T-T-The wist of vawues (wowes) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, t-t-the API wiww a-a-assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – T-T-The wewative wow this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If y-y-you’d wike to contwow the wewative positionying o-o-of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must b-b-be between 0 and 4 (i.e. zewo indexed).

values[source]

A wist of wowes that have been sewected by the usew.

Type:

Wist[Role]

await callback(interaction, /)[source]

This function is a cowoutinye.

The cawwback associated with this UI item.

This can be uvwwiden by subcwasses.

Pawametews:

intewaction (MessageInteraction) – The intewaction that twiggewed this UI item.

property custom_id[source]

The ID of the sewect menyu that gets weceived duwing an intewaction.

Type:

str

property default_values[source]

The w-w-wist of vawues that awe sewected by defauwt. Onwy avaiwabwe fow auto-popuwated s-sewect menyus.

Type:

Wist[SelectDefaultValue]

property disabled[source]

Whethew the sewect menyu is disabwed.

Type:

bool

property id[source]

The n-nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

is_dispatchable()[source]

Whethew the sewect menyu is dispatchabwe. This wiww awways wetuwn True.

Wetuwn type:

bool

property max_values[source]

The maximum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property min_values[source]

The minyimum n-nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property placeholder[source]

The pwacehowdew text that is shown if nyothing is sewected, if any.

T-T-Type:

Optionyaw[str]

property view[source]

The undewwying view fow this item.

Type:

Optionyaw[View]

UsewSewect

class disnake.ui.UserSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, id=0, row=None)[source]

Wepwesents a-a UI usew sewect menyu.

This is usuawwy wepwesented as a dwop down menyu.

In o-owdew to get the sewected items that the usew has chosen, use values.

Nyew in vewsion 2.7.

Pawametews:
  • custom_id (str) – The ID of the sewect menyu that gets weceived duwing an i-intewaction. If nyot given then onye is g-g-genyewated fow you.

  • p-pwacehowdew (Optionyaw[str]) – The p-p-pwacehowdew text t-t-that is shown if nyothing is sewected, if any.

  • min_vawues (int) – T-T-The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The m-m-maximum nyumbew of items that must be chosen fow t-t-this sewect menyu. Defauwts to 1 and must b-b-be between 1 and 25.

  • d-disabwed (bool) – Whethew t-the sewect is disabwed.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[User, Member, SelectDefaultValue, Object]]]) –

    The wist of vawues (usews/membews) that awe sewected by defauwt. If s-s-set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw i-identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 w-w-wows. If you’d wike to contwow the wewative positionying of the wow t-t-then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. z-z-zewo indexed).

values[source]

A wist of usews/membews that have been sewected by t-the usew.

Type:

Wist[User, Member]

await callback(interaction, /)[source]

This function is a-a cowoutinye.

The cawwback associated with this UI item.

This can be uvwwiden by subcwasses.

Pawametews:

intewaction (MessageInteraction) – T-T-The intewaction that twiggewed this UI item.

property custom_id[source]

The ID of the sewect menyu that gets weceived duwing an i-i-intewaction.

Type:

str

property default_values[source]

The wist of vawues that awe sewected by defauwt. Onwy avaiwabwe f-fow auto-popuwated sewect menyus.

Type:

Wist[SelectDefaultValue]

property disabled[source]

Whethew the sewect menyu is disabwed.

Type:

bool

property id[source]

The n-nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

is_dispatchable()[source]

Whethew the sewect menyu is dispatchabwe. This wiww awways wetuwn True.

Wetuwn type:

bool

property max_values[source]

The maximum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property min_values[source]

The minyimum nyumbew of items that must be chosen fow this sewect menyu.

Type:

int

property placeholder[source]

The pwacehowdew text that is s-s-shown if nyothing is sewected, if any.

Type:

Optionyaw[str]

property view[source]

The undewwying view fow t-this item.

Type:

Optionyaw[View]

TextInput

class disnake.ui.TextInput(*, label, custom_id, style=TextInputStyle.short, placeholder=None, value=None, required=True, min_length=None, max_length=None, id=0)[source]

Wepwesents a UI text input.

This c-c-can onwy be used in a Modal.

Nyew in vewsion 2.4.

Pawametews:
  • wabew (str) – The wabew of the text i-input.

  • custom_id (str) – The ID of the text input that gets weceived duwing an intewaction.

  • stywe (TextInputStyle) – The stywe of the text input.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if n-n-nyothing is entewed.

  • vawue (Optionyaw[str]) – The pwe-fiwwed vawue of the text input.

  • wequiwed (bool) – Whethew the text input is wequiwed. Defauwts to True.

  • min_wength (Optionyaw[int]) – The minyimum wength of the text input.

  • max_wength (Optionyaw[int]) – T-T-The maximum wength of the text input.

  • id (int) –

    The nyumewic i-i-identifiew fow the c-c-componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents i-i-in the message.

    Nyew in vewsion 2.11.

property style[source]

The stywe of the text input.

Type:

TextInputStyle

property label[source]

The w-w-wabew of the text input.

T-Type:

str

property custom_id[source]

The ID of the t-text input that g-gets weceived duwing an intewaction.

Type:

str

property placeholder[source]

T-The pwacehowdew text that i-i-is shown if nyothing is entewed.

Type:

Optionyaw[str]

property value[source]

The pwe-fiwwed text of the text input.

Type:

O-Optionyaw[str]

property required[source]

Whethew the text input is wequiwed.

Type:

bool

property min_length[source]

T-T-The minyimum wength of the text input.

Type:

Optionyaw[int]

property max_length[source]

The maximum w-w-wength of the text input.

Type:

Optionyaw[int]

Section

Attwibutes
class disnake.ui.Section(*components, accessory, id=0)[source]

Wepwesents a UI section.

This awwows dispwaying an accessowy (thumbnyaiw o-o-ow button) nyext to a bwock of text.

Nyew in vewsion 2.11.

Pawametews:
  • *componyents (Unyion[str, TextDisplay]) – The text items in this section (up to 3).

  • accessowy (Unyion[Thumbnail, Button]) – The accessowy componyent dispwayed nyext to the section text.

  • id (int) – The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

children

The wist of text items in this section.

Type:

Wist[TextDisplay]

accessory

The accessowy componyent dispwayed nyext to the section text.

Type:

Unyion[Thumbnail, Button]

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

TextDispway

Attwibutes
class disnake.ui.TextDisplay(content, *, id=0)[source]

Wepwesents a UI text d-dispway.

Nyew in vewsion 2.11.

Pawametews:
  • content (str) – The text dispwayed by this componyent.

  • id (int) – The nyumewic identifiew fow the componyent. Must be unyique within the message. If s-set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

property content[source]

The text dispwayed by this componyent.

Type:

str

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in c-componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

Thumbnyaiw

class disnake.ui.Thumbnail(media, description=None, *, spoiler=False, id=0)[source]

Wepwesents a UI thumbnyaiw.

This i-is onwy suppowted as the accessory o-o-of a section componyent.

N-Nyew in vewsion 2.11.

Pawametews:
  • media (Unyion[str, Asset, Attachment, UnfurledMediaItem]) – The media item to dispway. C-C-Can be an awbitwawy UWW ow attachment wefewence (attachment://<filename>).

  • d-descwiption (Optionyaw[str]) – The thumbnyaiw’s descwiption (“awt text”), if any.

  • spoiwew (bool) – Whethew the thumbnyaiw is mawked as a spoiwew. Defauwts to False.

  • id (int) – The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

property media[source]

The media item to dispway.

Type:

UnfurledMediaItem

property description[source]

The thumbnyaiw’s descwiption (“awt text”), if a-a-any.

Type:

Optionyaw[str]

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in v-vewsion 2.11.

Type:

int

property spoiler[source]

Whethew the thumbnyaiw i-i-is mawked as a spoiwew.

T-Type:

bool

MediaGawwewy

Attwibutes
class disnake.ui.MediaGallery(*items, id=0)[source]

Wepwesents a UI media gawwewy.

This awwows dispwaying up to 10 images in a gawwewy.

Nyew in v-v-vewsion 2.11.

Pawametews:
  • *items (MediaGalleryItem) – The wist of images in this gawwewy (up to 10).

  • id (int) – The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) w-w-when s-sending a-a-a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

property id[source]

The nyumewic i-i-identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

property items[source]

The images in this gawwewy.

T-T-Type:

Wist[MediaGalleryItem]

Fiwe

Attwibutes
class disnake.ui.File(file, *, spoiler=False, id=0)[source]

Wepwesents a UI fiwe componyent.

Nyew in vewsion 2.11.

Pawametews:
  • fiwe (Unyion[str, UnfurledMediaItem]) – The fiwe to dispway. This onwy suppowts attachment wefewences (i.e. using the attachment://<filename> syntax), nyot awbitwawy UWWs.

  • spoiwew (bool) – Whethew the fiwe is mawked as a spoiwew. Defauwts to False.

  • id (int) – The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

property file[source]

The fiwe to dispway.

Type:

UnfurledMediaItem

property spoiler[source]

Whethew the fiwe is mawked as a spoiwew.

Type:

bool

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

N-Nyew i-i-in vewsion 2.11.

Type:

int

property name[source]

The nyame of the fiwe. This is avaiwabwe in objects fwom the A-API, and ignyowed when sending.

Type:

Optionyaw[str]

property size[source]

The size of the fiwe. This i-is avaiwabwe in objects fwom the API, and ignyowed when sending.

Type:

Optionyaw[int]

Sepawatow

Attwibutes
class disnake.ui.Separator(*, divider=True, spacing=SeparatorSpacing.small, id=0)[source]

Wepwesents a UI sepawatow.

Nyew in vewsion 2.11.

Pawametews:
  • dividew (bool) – Whethew t-t-the sepawatow shouwd be visibwe, instead of j-just being vewticaw padding/spacing. Defauwts to True.

  • spacing (SeparatorSpacing) – The size of the sepawatow padding. Defauwts to small.

  • id (int) – The nyumewic i-identifiew fow the componyent. M-M-Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

property divider[source]

Whethew the sepawatow shouwd be visibwe, instead of just being vewticaw padding/spacing.

Type:

bool

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique w-within a message.

Nyew in vewsion 2.11.

Type:

int

property spacing[source]

The size of the sepawatow.

Type:

SeparatorSpacing

Containyew

class disnake.ui.Container(*components, accent_colour=None, spoiler=False, id=0)[source]

W-W-Wepwesents a UI containyew.

This i-is visuawwy simiwaw to Embeds, and contains othew componyents.

Nyew in vewsion 2.11.

Pawametews:
  • *componyents (Unyion[ActionRow, Section, TextDisplay, MediaGallery, File, Separator]) – The componyents i-i-in this containyew.

  • accent_cowouw (Optionyaw[Colour]) – The a-accent cowouw of the containyew.

  • spoiwew (bool) – Whethew the containyew is mawked as a spoiwew. Defauwts to False.

  • id (int) – The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw i-i-identifiews to the componyents in the message.

children

The wist of chiwd componyents in this containyew.

Type:

Wist[Unyion[ActionRow, Section, TextDisplay, MediaGallery, File, Separator]]

accent_colour[source]

T-T-The accent cowouw of the containyew. An awias exists undew accent_color.

Type:

Optionyaw[Colour]

spoiler

Whethew the containyew is mawked as a-a spoiwew.

Type:

bool

property id[source]

The nyumewic identifiew fow the componyent. This is awways pwesent in componyents weceived fwom the API, and unyique within a message.

Nyew in vewsion 2.11.

Type:

int

Functions

@disnake.ui.button(cls=Button, *, custom_id=..., style=ButtonStyle.secondary, label=None, disabled=False, url=None, emoji=None, row=None)[source]

A decowatow that attaches a button to a componyent.

The function being decowated s-s-shouwd have thwee pawametews, self wepwesenting the disnake.ui.View, the disnake.ui.Button that was intewacted with, and the disnake.MessageInteraction.

Nyote

Wink/Pwemium buttons cannyot be cweated with this function, since these buttons do nyot have a cawwback associated with them. Considew cweating a Button manyuawwy instead, and a-adding it using View.add_item().

Pawametews:
  • cws (Cawwabwe[…, Button]) –

    A cawwabwe (may be a Button subcwass) to cweate a nyew instance of this componyent. If pwovided, the othew pawametews descwibed bewow do nyot appwy. Instead, this decowatow wiww accept the same keywowds as the passed cawwabwe/cwass does.

    Nyew in vewsion 2.6.

  • wabew (Optionyaw[str]) – The wabew of the button, if any.

  • custom_id (Optionyaw[str]) – The ID of the button that gets weceived duwing an intewaction. It is wecommended nyot to set this pawametew t-t-to pwevent confwicts.

  • stywe (ButtonStyle) – The stywe of the button. Defauwts to ButtonStyle.grey.

  • disabwed (bool) – Whethew the button is disabwed. Defauwts to False.

  • emoji (Optionyaw[Unyion[str, Emoji, PartialEmoji]]) – The emoji of the button. This c-c-can be in stwing f-f-fowm ow a PartialEmoji ow a fuww Emoji.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to t-t-the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this button bewongs to. A D-Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike to contwow the wewative positionying of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up b-befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

@disnake.ui.string_select(cls=StringSelect, *, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)[source]

A decowatow that attaches a stwing sewect menyu to a componyent.

The function being decowated shouwd have thwee pawametews, self wepwesenting the disnake.ui.View, t-t-the disnake.ui.StringSelect that was intewacted with, and the disnake.MessageInteraction.

In owdew to get the sewected items that the usew has chosen within the cawwback use StringSelect.values.

Changed in vewsion 2.7: Wenyamed fwom select to string_select.

Pawametews:
  • cws (Cawwabwe[…, StringSelect]) –

    A cawwabwe (may be a StringSelect subcwass) to cweate a nyew instance of this componyent. If pwovided, the othew pawametews descwibed bewow do nyot appwy. Instead, this decowatow wiww accept the same keywowds as the passed cawwabwe/cwass does.

    Nyew in vewsion 2.6.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • custom_id (str) – The I-I-ID of the sewect menyu that gets weceived duwing an intewaction. It is wecommended nyot to s-s-set this p-pawametew to pwevent confwicts.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • options (Unyion[Wist[disnake.SelectOption], Wist[str], Dict[str, str]]) –

    A wist of o-o-options that can be sewected in this menyu. Use expwicit SelectOptions fow finye-gwainyed contwow uvw the options. Awtewnyativewy, a wist o-o-of stwings wiww be tweated as a-a-a wist of wabews, and a dict wiww be tweated as a mapping of wabews to vawues.

    C-C-Changed in vewsion 2.5: Nyow awso accepts a wist of stw ow a dict of stw to stw, which awe t-t-then appwopwiatewy pawsed as SelectOption wabews and vawues.

  • disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique w-w-within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    N-Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into t-those 5 wows. If y-y-you’d wike t-to contwow t-the wewative positionying o-o-of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. z-zewo indexed).

@disnake.ui.channel_select(cls=ChannelSelect, *, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, channel_types=None, default_values=None, row=None)[source]

A decowatow that attaches a channyew sewect menyu to a componyent.

The f-f-function b-being decowated shouwd have thwee p-pawametews, self wepwesenting the disnake.ui.View, the disnake.ui.ChannelSelect that was intewacted w-with, and the disnake.MessageInteraction.

In owdew to get the sewected items that the usew has c-c-chosen within the cawwback use ChannelSelect.values.

Nyew in vewsion 2.7.

Pawametews:
  • cws (Cawwabwe[…, ChannelSelect]) – A-A-A cawwabwe (may be a ChannelSelect s-s-subcwass) to cweate a nyew instance o-of this componyent. If pwovided, the othew pawametews descwibed bewow do nyot appwy. Instead, this decowatow wiww accept the same keywowds as the passed cawwabwe/cwass does.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • custom_id (str) – The ID of the sewect menyu that gets weceived d-duwing an intewaction. It is wecommended nyot to set this pawametew to pwevent confwicts.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 a-and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • d-disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • channyew_types (Optionyaw[Wist[ChannelType]]) – The wist of channyew types that can b-b-be sewected i-in this sewect menyu. Defauwts to aww types (i.e. None).

  • defauwt_vawues (Optionyaw[Sequence[Unyion[abc.GuildChannel, Thread, abc.PrivateChannel, PartialMessageable, SelectDefaultValue, Object]]]) –

    The wist of vawues (channyews) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this sewect menyu bewongs to. A Discowd c-componyent can onwy h-have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If y-you’d wike to contwow the wewative positionying of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe w-wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

@disnake.ui.mentionable_select(cls=MentionableSelect, *, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, row=None)[source]

A decowatow that attaches a-a-a mentionyabwe (usew/membew/wowe) sewect menyu to a componyent.

The function being d-d-decowated shouwd have thwee pawametews, self wepwesenting the disnake.ui.View, the disnake.ui.MentionableSelect t-that was intewacted with, and the disnake.MessageInteraction.

I-I-In owdew to get the sewected items that t-t-the usew has chosen within the cawwback use MentionableSelect.values.

Nyew in vewsion 2.7.

Pawametews:
  • cws (Cawwabwe[…, MentionableSelect]) – A cawwabwe (may be a MentionableSelect subcwass) to cweate a nyew instance of this componyent. If pwovided, the othew pawametews descwibed bewow do nyot appwy. Instead, this decowatow wiww accept the same keywowds as the passed cawwabwe/cwass does.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is s-s-shown if nyothing is sewected, if any.

  • custom_id (str) – The ID of t-the sewect menyu that gets weceived duwing an intewaction. It is wecommended nyot to set this pawametew to pwevent confwicts.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect m-m-menyu. Defauwts to 1 and must b-b-be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew t-the s-s-sewect is d-disabwed. Defauwts to False.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[User, Member, Role, SelectDefaultValue]]]) –

    The wist of vawues (usews/wowes) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyote that u-unwike o-othew sewect menyu types, this does nyot suppowt Objects due to ambiguities.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) w-when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in t-the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative w-wow t-t-this sewect menyu bewongs t-to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike to contwow the wewative positionying of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up b-b-befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

@disnake.ui.role_select(cls=RoleSelect, *, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, row=None)[source]

A decowatow that attaches a wowe sewect menyu to a componyent.

The function being decowated shouwd have thwee pawametews, self wepwesenting the disnake.ui.View, the disnake.ui.RoleSelect that was intewacted with, and the disnake.MessageInteraction.

In owdew to get the sewected items that the u-u-usew has chosen within the cawwback use RoleSelect.values.

Nyew in vewsion 2.7.

Pawametews:
  • cws (Cawwabwe[…, RoleSelect]) – A cawwabwe (may be a-a-a RoleSelect subcwass) to cweate a nyew instance of this componyent. If pwovided, the othew pawametews descwibed bewow do nyot appwy. Instead, this decowatow wiww accept the same keywowds as the passed cawwabwe/cwass does.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew t-text that is shown if n-n-nyothing is s-s-sewected, if a-any.

  • custom_id (str) – The ID of the sewect menyu that gets weceived duwing an intewaction. It is wecommended nyot to set this pawametew to pwevent confwicts.

  • min_vawues (int) – The minyimum nyumbew of i-items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that m-m-must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[Role, SelectDefaultValue, Object]]]) –

    The wist of vawues (wowes) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values a-and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic i-identifiew fow the componyent. Must be unyique within the message. If set to 0 (the defauwt) when sending a componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative w-w-wow this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike to contwow the wewative positionying of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

@disnake.ui.user_select(cls=UserSelect, *, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, default_values=None, row=None)[source]

A decowatow that attaches a usew sewect menyu to a componyent.

The function being decowated shouwd have thwee pawametews, self wepwesenting the disnake.ui.View, the disnake.ui.UserSelect that was intewacted w-w-with, and the disnake.MessageInteraction.

In owdew to get the sewected items that the usew h-has chosen within the cawwback use UserSelect.values.

Nyew in vewsion 2.7.

Pawametews:
  • cws (C-C-Cawwabwe[…, UserSelect]) – A cawwabwe (may be a UserSelect subcwass) to cweate a nyew i-instance of this componyent. If pwovided, the othew pawametews descwibed bewow do nyot appwy. Instead, this decowatow wiww accept the same keywowds as the passed cawwabwe/cwass does.

  • pwacehowdew (Optionyaw[str]) – The pwacehowdew text that is shown if nyothing is sewected, if any.

  • custom_id (str) – T-The ID of the sewect menyu that gets weceived duwing an intewaction. It is w-w-wecommended nyot to set this pawametew to pwevent confwicts.

  • min_vawues (int) – The minyimum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must b-be between 1 and 25.

  • max_vawues (int) – The maximum nyumbew of items that must be chosen fow this sewect menyu. Defauwts to 1 and must be between 1 and 25.

  • disabwed (bool) – Whethew the sewect is disabwed. Defauwts to False.

  • defauwt_vawues (Optionyaw[Sequence[Unyion[User, Member, SelectDefaultValue, Object]]]) –

    The wist of vawues (usews/membews) that awe sewected by defauwt. If set, the nyumbew of items must be within the bounds set by min_values and max_values.

    Nyew in vewsion 2.10.

  • id (int) –

    The nyumewic i-identifiew fow the componyent. Must b-b-be unyique within the message. If s-set to 0 (the defauwt) when s-s-sending a c-c-componyent, the API wiww assign sequentiaw identifiews to the componyents in the message.

    Nyew in vewsion 2.11.

  • wow (Optionyaw[int]) – The wewative wow this sewect menyu bewongs to. A Discowd componyent can onwy have 5 wows. By defauwt, items awe awwanged automaticawwy into those 5 wows. If you’d wike to contwow the wewative positionying of the wow then passing an index is advised. Fow exampwe, wow=1 wiww show up befowe wow=2. Defauwts to None, which is automatic owdewing. The wow nyumbew must be between 0 and 4 (i.e. zewo indexed).

for ... in disnake.ui.walk_components(components)[source]

I-Itewate uvw given componyents, yiewding each individuaw componyent, incwuding chiwd componyents whewe appwicabwe (e.g. fow ActionRow and Container).

Nyew in vewsion 2.11.

Pawametews:

componyents (Unyion[Sequence[Component], Sequence[UIComponent]]) – The sequence of componyents to itewate uvw. This suppowts both disnake.Component objects and ui.UIComponent objects.

Y-Y-Yiewds:

Unyion[Component, UIComponent] – A componyent fwom t-the given sequence ow chiwd componyent theweof.

disnake.ui.components_from_message(message)[source]

C-Cweate a wist o-of UIComponents fwom the c-c-componyents of an existing message.

T-This wiww abide by existing componyent fowmat on the message, incwuding componyent owdewing. Componyents wiww be twansfowmed to UI kit c-c-componyents, s-such that they can be easiwy modified and we-sent.

Nyew in vewsion 2.11.

Pawametews:

message (disnake.Message) – The message fwom which to extwact the componyents.

Waises:

TypeEwwow – An unknyown componyent type is encountewed.

Wetuwns:

The ui componyents pawsed fwom the componyents on the message.

Wetuwn type:

Wist[UIComponent]