From 16c696cd9948b016b097e1c0b03c54a5bfc4b994 Mon Sep 17 00:00:00 2001 From: Om Lanke <92863779+OmLanke@users.noreply.github.com> Date: Fri, 22 Dec 2023 12:38:49 +0530 Subject: [PATCH] fix: handle ephemeral messages in `disable_on_timeout` (#2297) * attempt fix * style(pre-commit): auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- discord/ui/view.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/ui/view.py b/discord/ui/view.py index 5bf96f2612..322371d080 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -368,7 +368,12 @@ async def on_timeout(self) -> None: """ if self.disable_on_timeout: self.disable_all_items() - message = self._message or self.parent + + if not self._message or self._message.flags.ephemeral: + message = self.parent + else: + message = self.message + if message: m = await message.edit(view=self) if m: