Skip to content

Commit 3fed0e9

Browse files
authored
Merge branch 'master' into feat/get-guild-role-member-counts
2 parents e4134ba + 2074aea commit 3fed0e9

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

.github/workflows/lib-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
pip install -r requirements/dev.txt
8484
- name: "Setup cache"
8585
id: cache-pylint
86-
uses: actions/cache@v4
86+
uses: actions/cache@v5
8787
with:
8888
path: .pylint.d
8989
key: pylint
@@ -107,7 +107,7 @@ jobs:
107107
pip install -r requirements/dev.txt
108108
- name: "Setup cache"
109109
id: cache-mypy
110-
uses: actions/cache@v4
110+
uses: actions/cache@v5
111111
with:
112112
path: .mypy_cache
113113
key: mypy
@@ -142,7 +142,7 @@ jobs:
142142
pip install -r requirements/dev.txt
143143
- name: "Setup cache"
144144
id: cache-pytest
145-
uses: actions/cache@v4
145+
uses: actions/cache@v5
146146
with:
147147
path: .pytest_cache
148148
key: ${{ matrix.os }}-${{ matrix.python-version }}-pytest

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
- id: isort
3232
exclude: \.(po|pot|yml|yaml)$
3333
- repo: https://github.com/psf/black-pre-commit-mirror
34-
rev: 25.11.0
34+
rev: 25.12.0
3535
hooks:
3636
- id: black
3737
args: [--safe, --quiet]

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ These changes are available on the `master` branch, but have not yet been releas
2424

2525
### Fixed
2626

27+
- Fixed `TypeError` in paginator implementation when only passing `PageGroup` objects
28+
and `show_menu` is falsy.
29+
([#2993](https://github.com/Pycord-Development/pycord/pull/2993))
2730
- Fixed breaking change in `ui.Select` Generic typing by adding default values to
2831
TypeVars. ([#3002](https://github.com/Pycord-Development/pycord/pull/3002))
32+
- Fixed `View`'s `disable_on_timeout` not working in private (DM) channels.
33+
([#3016](https://github.com/Pycord-Development/pycord/pull/3016))
2934

3035
### Deprecated
3136

discord/ext/pages/pagination.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,20 @@ def __init__(
418418
self.default_page_group: int = 0
419419

420420
if all(isinstance(pg, PageGroup) for pg in pages):
421-
self.page_groups = self.pages if show_menu else None
422-
if sum(pg.default is True for pg in self.page_groups) > 1:
421+
if sum(pg.default is True for pg in pages) > 1:
423422
raise ValueError("Only one PageGroup can be set as the default.")
424-
for pg in self.page_groups:
423+
424+
default_pg_index = 0
425+
for pg in pages:
425426
if pg.default:
426-
self.default_page_group = self.page_groups.index(pg)
427+
default_pg_index = pages.index(pg)
427428
break
429+
428430
self.pages: list[Page] = self.get_page_group_content(
429-
self.page_groups[self.default_page_group]
431+
pages[default_pg_index]
430432
)
431433

434+
self.page_groups = self.pages if show_menu else None
432435
self.page_count = max(len(self.pages) - 1, 0)
433436
self.buttons = {}
434437
self.custom_buttons: list = custom_buttons
@@ -530,16 +533,20 @@ async def update(
530533
) = (pages if pages is not None else self.pages)
531534
self.show_menu = show_menu if show_menu is not None else self.show_menu
532535
if pages is not None and all(isinstance(pg, PageGroup) for pg in pages):
533-
self.page_groups = self.pages if self.show_menu else None
534-
if sum(pg.default is True for pg in self.page_groups) > 1:
536+
if sum(pg.default is True for pg in pages) > 1:
535537
raise ValueError("Only one PageGroup can be set as the default.")
536-
for pg in self.page_groups:
538+
539+
default_pg_index = 0
540+
for pg in pages:
537541
if pg.default:
538-
self.default_page_group = self.page_groups.index(pg)
542+
default_pg_index = pages.index(pg)
539543
break
544+
540545
self.pages: list[Page] = self.get_page_group_content(
541-
self.page_groups[self.default_page_group]
546+
pages[default_pg_index]
542547
)
548+
549+
self.page_groups = self.pages if show_menu else None
543550
self.page_count = max(len(self.pages) - 1, 0)
544551
self.current_page = current_page if current_page <= self.page_count else 0
545552
# Apply config changes, if specified

discord/ui/view.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from ..components import TextDisplay as TextDisplayComponent
5656
from ..components import Thumbnail as ThumbnailComponent
5757
from ..components import _component_factory
58+
from ..enums import ChannelType
5859
from ..utils import find
5960
from .core import ItemInterface
6061
from .item import ItemCallbackType, ViewItem
@@ -303,7 +304,11 @@ async def on_timeout(self) -> None:
303304
if self.disable_on_timeout:
304305
self.disable_all_items()
305306

306-
if not self._message or self._message.flags.ephemeral:
307+
if (
308+
not self._message
309+
or self._message.flags.ephemeral
310+
or (self._message.channel.type == ChannelType.private)
311+
):
307312
message = self.parent
308313
else:
309314
message = self.message

0 commit comments

Comments
 (0)