From d8ef917c9eb5cb4dbb100ad1b57c36b0b0c51806 Mon Sep 17 00:00:00 2001 From: HyperGH <46067571+HyperGH@users.noreply.github.com> Date: Tue, 10 Jan 2023 13:16:47 +0100 Subject: [PATCH] Fix navigator attachments --- docs/source/changelogs/v2.rst | 6 ++++++ miru/__init__.py | 2 +- miru/context/base.py | 24 ++++++++++++------------ miru/ext/nav/navigator.py | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/docs/source/changelogs/v2.rst b/docs/source/changelogs/v2.rst index 19d41aa7..e8f33e0c 100644 --- a/docs/source/changelogs/v2.rst +++ b/docs/source/changelogs/v2.rst @@ -6,6 +6,12 @@ These are all the changelogs for stable releases of hikari-miru (version 2.0.0 t ---- +Version 2.0.2 +============= + +- Fix ``Context.edit_response()`` typehints. +- Fix navigator attachments being kept between page changes. + Version 2.0.1 ============= diff --git a/miru/__init__.py b/miru/__init__.py index 4bbd7fae..959375ba 100644 --- a/miru/__init__.py +++ b/miru/__init__.py @@ -9,7 +9,7 @@ from .traits import * from .view import * -__version__ = "2.0.1" +__version__ = "2.0.2" # MIT License # diff --git a/miru/context/base.py b/miru/context/base.py index 5a59ab85..549bd0cd 100644 --- a/miru/context/base.py +++ b/miru/context/base.py @@ -379,12 +379,12 @@ async def edit_response( *, flags: t.Union[int, hikari.MessageFlag, hikari.UndefinedType] = hikari.UNDEFINED, tts: hikari.UndefinedOr[bool] = hikari.UNDEFINED, - component: hikari.UndefinedOr[hikari.api.ComponentBuilder] = hikari.UNDEFINED, - components: hikari.UndefinedOr[t.Sequence[hikari.api.ComponentBuilder]] = hikari.UNDEFINED, - attachment: hikari.UndefinedOr[hikari.Resourceish] = hikari.UNDEFINED, - attachments: hikari.UndefinedOr[t.Sequence[hikari.Resourceish]] = hikari.UNDEFINED, - embed: hikari.UndefinedOr[hikari.Embed] = hikari.UNDEFINED, - embeds: hikari.UndefinedOr[t.Sequence[hikari.Embed]] = hikari.UNDEFINED, + component: hikari.UndefinedNoneOr[hikari.api.ComponentBuilder] = hikari.UNDEFINED, + components: hikari.UndefinedNoneOr[t.Sequence[hikari.api.ComponentBuilder]] = hikari.UNDEFINED, + attachment: hikari.UndefinedNoneOr[hikari.Resourceish] = hikari.UNDEFINED, + attachments: hikari.UndefinedNoneOr[t.Sequence[hikari.Resourceish]] = hikari.UNDEFINED, + embed: hikari.UndefinedNoneOr[hikari.Embed] = hikari.UNDEFINED, + embeds: hikari.UndefinedNoneOr[t.Sequence[hikari.Embed]] = hikari.UNDEFINED, mentions_everyone: hikari.UndefinedOr[bool] = hikari.UNDEFINED, user_mentions: hikari.UndefinedOr[ t.Union[hikari.SnowflakeishSequence[hikari.PartialUser], bool] @@ -402,17 +402,17 @@ async def edit_response( The content of the message. Anything passed here will be cast to str. tts : undefined.UndefinedOr[bool], optional If the message should be tts or not. - attachment : undefined.UndefinedOr[hikari.Resourceish], optional + attachment : undefined.UndefinedNoneOr[hikari.Resourceish], optional An attachment to add to this message. - attachments : undefined.UndefinedOr[t.Sequence[hikari.Resourceish]], optional + attachments : undefined.UndefinedNoneOr[t.Sequence[hikari.Resourceish]], optional A sequence of attachments to add to this message. - component : undefined.UndefinedOr[hikari.api.special_endpoints.ComponentBuilder], optional + component : undefined.UndefinedNoneOr[hikari.api.special_endpoints.ComponentBuilder], optional A component to add to this message. - components : undefined.UndefinedOr[t.Sequence[hikari.api.special_endpoints.ComponentBuilder]], optional + components : undefined.UndefinedNoneOr[t.Sequence[hikari.api.special_endpoints.ComponentBuilder]], optional A sequence of components to add to this message. - embed : undefined.UndefinedOr[hikari.Embed], optional + embed : undefined.UndefinedNoneOr[hikari.Embed], optional An embed to add to this message. - embeds : undefined.UndefinedOr[t.Sequence[hikari.Embed]], optional + embeds : undefined.UndefinedNoneOr[t.Sequence[hikari.Embed]], optional A sequence of embeds to add to this message. mentions_everyone : undefined.UndefinedOr[bool], optional If True, mentioning @everyone will be allowed. diff --git a/miru/ext/nav/navigator.py b/miru/ext/nav/navigator.py index 9baac785..9d1c5257 100644 --- a/miru/ext/nav/navigator.py +++ b/miru/ext/nav/navigator.py @@ -198,7 +198,7 @@ async def send_page(self, context: Context[t.Any], page_index: t.Optional[int] = self._inter = context.interaction # Update latest inter - await context.edit_response(**payload) + await context.edit_response(**payload, attachment=None) async def start( self,