Skip to content

Paginators cannot be used after an extended period of time #1083

@Ahsoka

Description

@Ahsoka

Summary

Trying to using a paginator after some extended period of time will cause an error.

Reproduction Steps

Create a paginator and wait an extended period of time. In my case I waited 24 hours (without disabling/turning off the bot). Then try using the paginator.

Minimal Reproducible Code

from discord.ext.pages import Paginator
from typing import List, Tuple

import discord

debug_guilds: List[int] = ...
assert debug_guilds is not ..., 'Fill in debug_guild(s)'
bot = discord.Bot(debug_guilds=debug_guilds)

@bot.slash_command()
async def create(ctx: discord.ApplicationContext):
    paginator = Paginator(['Hello!', 'There!'], timeout=None, disable_on_timeout=False)
    await paginator.respond(ctx.interaction)

@bot.event
async def on_ready():
    print(f"{bot.user} is ready!")

token = ...
assert token is not ..., 'Use a valid token!'
bot.run(token)

# NOTE: Now try using the paginator after an extended period of time.

Expected Results

The paginator should work as normal.

Actual Results

The following error occured:

Traceback (most recent call last):
  File "/home/clovis/clovis/env/lib/python3.8/site-packages/discord/ui/view.py", line 365, in _scheduled_task
    await item.callback(interaction)
  File "/home/clovis/clovis/env/lib/python3.8/site-packages/discord/ext/pages/pagination.py", line 107, in callback
    await self.paginator.goto_page(page_number=self.paginator.current_page)
  File "/home/clovis/clovis/clovis/utils.py", line 173, in goto_page
    return await super().goto_page(page_number)
  File "/home/clovis/clovis/env/lib/python3.8/site-packages/discord/ext/pages/pagination.py", line 472, in goto_page
    return await self.message.edit(
  File "/home/clovis/clovis/env/lib/python3.8/site-packages/discord/interactions.py", line 898, in edit
    return await self._state._interaction.edit_original_message(
  File "/home/clovis/clovis/env/lib/python3.8/site-packages/discord/interactions.py", line 355, in edit_original_message
    data = await adapter.edit_original_interaction_response(
  File "/home/clovis/clovis/env/lib/python3.8/site-packages/discord/webhook/async_.py", line 194, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token

Intents

I don't think intents are relevant here, if they are, here's the intents I used: discord.Intents(guilds=True, members=True)

System Information

OS: Windows 10
Python Version: 3.8.11
Pycord Version: 2.0.0b4

Checklist

  • 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

I'm not sure if this is a Discord issue or a Pycord issue or both. It seems like this functionality should work because the bot did get a message from the Discord that a button was pushed but for some reason the bot errors out.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions