-
-
Notifications
You must be signed in to change notification settings - Fork 484
Labels
bugSomething isn't workingSomething isn't workingcomponentsRelated to discord components (Views + Modals)Related to discord components (Views + Modals)ext.pagesRelating to ext.pagesRelating to ext.pages
Milestone
Description
Summary
#2981 broke custom views in paginator
Reproduction Steps
- Install py-cord 2.7
- Run the code below
- Press a paginator button
Minimal Reproducible Code
import discord
import os
from dotenv import load_dotenv
import logging
from discord.ext import pages
logging.basicConfig(level=logging.INFO)
load_dotenv()
bot = discord.Bot()
PAGES = [
"Page 1",
"Page 2",
]
@bot.slash_command()
async def ping(ctx: discord.ApplicationContext):
view = discord.ui.View(
discord.ui.Button(label="Test Button, Does Nothing", row=1),
)
view.add_item(
discord.ui.Select(
placeholder="Test Select Menu, Does Nothing",
options=[
discord.SelectOption(
label="Example Option",
value="Example Value",
description="This menu does nothing!",
)
],
)
)
paginator = pages.Paginator(pages=PAGES, custom_view=view)
await paginator.respond(ctx.interaction, ephemeral=False)
bot.run(os.getenv("TOKEN_2"))This code was slightly adapted from the custom view paginator example
Expected Results
The paginator to work AND to contain the custom button and select menu
Actual Results
The paginator DOES NOT work and is missing the custom button altogether, causing the following traceback when a button is pressed:
/home/paillat/Documents/pycord/pycord/.venv/bin/python /home/paillat/Documents/pycord/pycord/test_paginator.py
INFO:discord.client:logging in using static token
INFO:discord.gateway:Shard ID None has sent the IDENTIFY payload.
INFO:discord.gateway:Shard ID None has connected to Gateway: ["gateway-prd-arm-us-east1-b-zg1v",{"micros":149396,"calls":["id_created",{"micros":942,"calls":[]},"session_lookup_time",{"micros":302,"calls":[]},"session_lookup_finished",{"micros":13,"calls":[]},"discord-sessions-prd-2-124",{"micros":147693,"calls":["start_session",{"micros":143833,"calls":["discord-api-rpc-685f5fd59d-cssrx",{"micros":105491,"calls":["get_user",{"micros":72268},"get_guilds",{"micros":2630},"send_scheduled_deletion_message",{"micros":17},"guild_join_requests",{"micros":451},"authorized_ip_coro",{"micros":11},"pending_payments",{"micros":616},"apex_experiments",{"micros":31084},"user_activities",{"micros":6},"played_application_ids",{"micros":3},"linked_users",{"micros":3}]}]},"starting_guild_connect",{"micros":31,"calls":[]},"presence_started",{"micros":1648,"calls":[]},"guilds_started",{"micros":142,"calls":[]},"lobbies_started",{"micros":1,"calls":[]},"guilds_connect",{"micros":2,"calls":[]},"presence_connect",{"micros":2014,"calls":[]},"connect_finished",{"micros":2022,"calls":[]},"build_ready",{"micros":14,"calls":[]},"clean_ready",{"micros":0,"calls":[]},"optimize_ready",{"micros":0,"calls":[]},"split_ready",{"micros":1,"calls":[]}]}]}] (Session ID: 23bf8a20edd2958720dcab7d42454f4a).
Ignoring exception in view <Paginator timeout=180.0 children=5> for item <Button style=<ButtonStyle.success: 3> url=None disabled=True label='>' emoji=None sku_id=None row=0 custom_id='e40cb74e63f6a9e325a47bbc68e12ebe' id=None>:
Traceback (most recent call last):
File "/home/paillat/Documents/pycord/pycord/discord/ui/view.py", line 376, in _scheduled_task
await item.callback(interaction)
File "/home/paillat/Documents/pycord/pycord/discord/ext/pages/pagination.py", line 130, in callback
await self.paginator.goto_page(page_number=new_page, interaction=interaction)
File "/home/paillat/Documents/pycord/pycord/discord/ext/pages/pagination.py", line 715, in goto_page
page, files = self._goto_page(page_number)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/ext/pages/pagination.py", line 678, in _goto_page
self.update_buttons()
~~~~~~~~~~~~~~~~~~~^^
File "/home/paillat/Documents/pycord/pycord/discord/ext/pages/pagination.py", line 900, in update_buttons
self.update_custom_view(self.custom_view)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/ext/pages/pagination.py", line 908, in update_custom_view
self.remove_item(item)
~~~~~~~~~~~~~~~~^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/ui/view.py", line 716, in remove_item
super().remove_item(item)
~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/ui/view.py", line 263, in remove_item
item.parent.remove_item(item)
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'remove_item'
Intents
n/a
System Information
- Python v3.13.11-final
- py-cord v2.7.None-candidate
- py-cord importlib.metadata: v2.7.0rc3.dev5+g54f6576de
- aiohttp v3.13.2
- system info: Linux 6.12.63-1-lts #1 SMP PREEMPT_DYNAMIC Thu, 18 Dec 2025 14:48:15 +0000Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
Thank you to @DefiDebauchery for reporting this issue first
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcomponentsRelated to discord components (Views + Modals)Related to discord components (Views + Modals)ext.pagesRelating to ext.pagesRelating to ext.pages