Kord-Extensions/kord-extensions

Error when attempting to use paginator buttons after some time.

JustPyrrha opened this issue · 1 comments

Description

Interacting with a slash commands paginator response after some time causes an error.

Stacktrace from Sentry:

dev.kord.rest.request.KtorRequestException: REST request returned an error: 401 Unauthorized  Invalid Webhook Token null
    at dev.kord.rest.request.KtorRequestHandler.handle(KtorRequestHandler.kt:61)
    at dev.kord.rest.request.KtorRequestHandler$handle$1.invokeSuspend(KtorRequestHandler.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Versions

kord-extensions: 1.6.0

Reproduction

  1. Create a slash command that responds with a paginator.
  2. Send the command so that it responds with the paginator.
  3. Wait around 30 minutes, and leave the bot online.
  4. Interact with the paginator buttons.
  5. Error occurs.

This is unfortunately expected behaviour. From the Discord docs:

Interaction tokens are valid for 15 minutes, meaning you can respond to an interaction within that amount of time.

If you need something to live longer than that, you'll need to send it in a regular message. However, please note that paginators are designed to be short lived, and there's currently no way to persist them between bot restarts.