Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion discord/ui/media_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def add_item(
*,
description: str = None,
spoiler: bool = False,
) -> None:
) -> Self:
"""Adds a new media item to the gallery.

Parameters
Expand Down
13 changes: 11 additions & 2 deletions discord/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
import time
from functools import partial
from itertools import groupby
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Iterator, Sequence, TypeVar
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Iterator,
Self,
Sequence,
TypeVar,
)

from ..components import ActionRow as ActionRowComponent
from ..components import Button as ButtonComponent
Expand Down Expand Up @@ -375,7 +384,7 @@ def _expires_at(self) -> float | None:
return time.monotonic() + self.timeout
return None

def add_item(self, item: Item[V]) -> None:
def add_item(self, item: Item[V]) -> Self:
"""Adds an item to the view.

Parameters
Expand Down
Loading