pycord
pycord copied to clipboard
Paginator fails with ctx.defer(ephemeral=True)
Summary
Paginator fails when not labeled as ephemeral and responding to an ephemeral defer
Reproduction Steps
See minimal example and attempt to change pages
Minimal Reproducible Code
import discord
import os
from dotenv import load_dotenv
from discord.ext import pages
load_dotenv()
bot = discord.Bot()
@bot.slash_command()
async def paginator(ctx):
paginator = pages.Paginator(["Pg 1", "Pg 2"])
await ctx.defer(ephemeral=True)
await paginator.respond(ctx.interaction)
bot.run(os.getenv('TOKEN'))
Expected Results
paginator works as intended
Actual Results
Paginator displays as expected, but page does not change and raises error:
File "<path-to-pycord>\commands\core.py", line 124, in wrapped
ret = await coro(arg)
File "<path-to-pycord>\commands\core.py", line 982, in _invoke
await self.callback(ctx, **kwargs)
File "<path-to-bot>\main.py", line 13, in paginator
await paginator.respond(ctx.interaction)
File "<path-to-pycord>\ext\pages\pagination.py", line 1171, in respond
msg = await msg.channel.fetch_message(msg.id)
File "<path-to-pycord>\abc.py", line 1696, in fetch_message
data = await self._state.http.get_message(channel.id, id)
File "<path-to-pycord>\http.py", line 367, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message
Intents
?
System Information
- Python v3.10.3-final
- py-cord v2.4.1-final
- aiohttp v3.8.1
- system info: Windows 10 10.0.19045
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
Easy workaround is await paginator.respond(ctx.interaction, ephemeral=True)
My guess is it's when it tries to edit the message, it can't find it.
Tested buttons and select menus using ctx.send_followup(<etc.>). Both worked as expected.