Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a16fc23
fix: ♻️ Handle discord.HTTPException during message edits in Paginat…
Lumabots Dec 5, 2025
c09094a
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2025
a198b8d
fix: ♻️ Update changelog to reflect changes in BaseView and Paginato…
Lumabots Dec 5, 2025
b4ad2d5
Merge branch 'master' into timeout-ignore
Lumabots Dec 12, 2025
56379e9
Update discord/ext/pages/pagination.py
Lumabots Dec 29, 2025
abb4713
fix: reorder timeout error handling in changelog
Lumabots Dec 29, 2025
f66d3d1
Merge branch 'master' into timeout-ignore
Lumabots Dec 29, 2025
568d4c2
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 29, 2025
7751415
fix: format changelog for better readability
Lumabots Dec 29, 2025
2711579
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 29, 2025
85027c7
chore: update changelog with new features, changes, and fixes for ver…
Lumabots Dec 29, 2025
3e14dea
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 29, 2025
a3f04b0
chore: update changelog with new features, changes, and fixes for Com…
Lumabots Dec 29, 2025
b225114
fix: improve error handling and clean up type annotations in Paginato…
Lumabots Dec 29, 2025
97c748e
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 29, 2025
1f6922f
fix: improve message handling and type hint formatting in BaseView an…
Lumabots Dec 30, 2025
0f74942
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 30, 2025
b0f0239
fix: replace discord error references with local imports in BaseView
Lumabots Jan 1, 2026
be34475
Merge branch 'master' into timeout-ignore
Lumabots Jan 4, 2026
8defd98
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 4, 2026
fe0f9bf
Apply suggestion from @Paillat-dev
Paillat-dev Jan 16, 2026
b2953f1
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 16, 2026
a919ee6
Merge branch 'master' into timeout-ignore
Paillat-dev Jan 16, 2026
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ These changes are available on the `master` branch, but have not yet been releas

### Fixed

- Fixed `BaseView.on_timeout` and `Paginator.on_timeout` behavior: views no longer raise
unnecessary errors on timeout.
([#3019](https://github.com/Pycord-Development/pycord/pull/3019))
- Fixed `RawMessageUpdateEvent.cached_message` being always `None` even when the message
was cached. ([#3038](https://github.com/Pycord-Development/pycord/pull/3038))
- Fixed downloading animated emojis which were originally uploaded as WebP files by
Expand Down
12 changes: 7 additions & 5 deletions discord/ext/pages/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from __future__ import annotations

import contextlib
from typing import List

import discord
Expand Down Expand Up @@ -604,11 +605,12 @@ async def on_timeout(self) -> None:
page = self.pages[self.current_page]
page = self.get_page_content(page)
files = page.update_files()
await self.message.edit(
view=self,
files=files or [],
attachments=[],
)
with contextlib.suppress(discord.NotFound, discord.Forbidden):
await self.message.edit(
view=self,
files=files or [],
attachments=[],
)

async def disable(
self,
Expand Down
24 changes: 15 additions & 9 deletions discord/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from __future__ import annotations

import asyncio
import contextlib
import os
import sys
import time
Expand Down Expand Up @@ -56,7 +57,7 @@
from ..components import Thumbnail as ThumbnailComponent
from ..components import _component_factory
from ..enums import ChannelType
from ..utils import find
from ..errors import Forbidden, NotFound
from .core import ItemInterface
from .item import ItemCallbackType, ViewItem

Expand Down Expand Up @@ -97,7 +98,6 @@ def _walk_all_components_v2(components: list[Component]) -> Iterator[Component]:


def _component_to_item(component: Component) -> ViewItem[V]:

if isinstance(component, ButtonComponent):
from .button import Button

Expand Down Expand Up @@ -321,9 +321,10 @@ async def on_timeout(self) -> None:
message = self.message

if message:
m = await message.edit(view=self)
if m:
self._message = m
with contextlib.suppress(NotFound, Forbidden):
m = await message.edit(view=self)
if m:
self._message = m

async def on_check_failure(self, interaction: Interaction) -> None:
"""|coro|
Expand Down Expand Up @@ -692,7 +693,7 @@ def add_item(self, item: ViewItem[V]) -> Self:

if item._underlying.is_v2():
raise ValueError(
f"cannot use V2 components in View. Use DesignerView instead."
"cannot use V2 components in View. Use DesignerView instead."
)
if isinstance(item._underlying, ActionRowComponent):
for i in item.children:
Expand Down Expand Up @@ -729,7 +730,9 @@ def clear_items(self) -> None:
def refresh(self, components: list[Component]):
# This is pretty hacky at the moment
old_state: dict[tuple[int, str], ViewItem[V]] = {
(item.type.value, item.custom_id): item for item in self.children if item.is_dispatchable() # type: ignore
(item.type.value, item.custom_id): item
for item in self.children
if item.is_dispatchable() # type: ignore
}
children: list[ViewItem[V]] = [
item for item in self.children if not item.is_dispatchable()
Expand Down Expand Up @@ -889,7 +892,7 @@ def add_item(self, item: ViewItem[V]) -> Self:

if isinstance(item._underlying, (SelectComponent, ButtonComponent)):
raise ValueError(
f"cannot add Select or Button to DesignerView directly. Use ActionRow instead."
"cannot add Select or Button to DesignerView directly. Use ActionRow instead."
)

super().add_item(item)
Expand Down Expand Up @@ -951,7 +954,10 @@ def add_view(self, view: BaseView, message_id: int | None = None):
view._start_listening_from_store(self)
for item in view.walk_children():
if item.is_storable():
self._views[(item.type.value, message_id, item.custom_id)] = (view, item) # type: ignore
self._views[(item.type.value, message_id, item.custom_id)] = (
view,
item,
) # type: ignore

if message_id is not None:
self._synced_message_views[message_id] = view
Expand Down