ABCs

class novus.Component

Abstract base class for all Discord UI components.

class novus.LayoutComponentHolder(components: Iterable[Component] = MISSING)

A generic layout component that holds other components.

This class implements a __getitem__ and an __iter__ method to allow for eady indexing and iterating.

Parameters:
  • components (Iterable[novus.Component]) – A list of components to be initially added to the section. Only supports one to three text display components.

  • accessory (novus.Component) – An accessory for the section. Only supports thumbnail or button components.

components

The components inside of the section.

Type:

list[novus.Component | None]

accessory
Type:

novus.Component | None

add(component: Component) Self

Add a component to the end of the section.

Parameters:

component (novus.Component) – The component that you want to add to the section.

Returns:

The instance, allowing for easy chaining.

Return type:

novus.LayoutComponentHolder

set(index: int, component: Component | None) Self

Set a component at a specified index. If the index given is larger than the current number of components, the components list will be filled with None values, which will be removed upon sending.

Parameters:
  • index (int) – The index that you want to set the component at.

  • component (novus.Component | None) – The component that you want to set.

Returns:

The instance, allowing for easy chaining.

Return type:

novus.LayoutComponentHolder

pop() Self

Pop a component from the end of the instance.

Returns:

The instance, allowing for easy chaining.

Return type:

novus.LayoutComponentHolder

clear() Self

Clear all of the components from the instance.

Returns:

The instance, allowing for easy chaining.

Return type:

novus.LayoutComponentHolder

class novus.InteractableComponent

Abstract base class for Discord UI components that users can interact with.