diff --git a/discord/ui/media_gallery.py b/discord/ui/media_gallery.py index b50daef71c..76732f2903 100644 --- a/discord/ui/media_gallery.py +++ b/discord/ui/media_gallery.py @@ -80,7 +80,7 @@ def add_item( *, description: str = None, spoiler: bool = False, - ) -> None: + ) -> Self: """Adds a new media item to the gallery. Parameters diff --git a/discord/ui/view.py b/discord/ui/view.py index ddb5368b51..e560aff60e 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -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 @@ -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