From 88464681ebe4c7d54ea45740751132c26631c11c Mon Sep 17 00:00:00 2001 From: Paillat Date: Sun, 21 Sep 2025 15:53:06 +0200 Subject: [PATCH] :label: Fix incorrect view rtypes --- discord/ui/media_gallery.py | 2 +- discord/ui/view.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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