Closed
Description
Library Version
5.11.0
Describe the Bug
Sending a interactions.ext.paginators
Paginator
will throw HTTP 400 when select menu is enabled using Paginator().show_select_menu
. Without the select menu enabled, the paginator sends just fine.
It is determined from the relevant code that the current Paginator
has no ability to limit the amount of select options to 25, causing the error.
interactions.py/interactions/ext/paginators.py
Lines 274 to 287 in 1a7de56
Steps to Reproduce
- Create a
Paginator
with at least 26 pages, for example usingPaginator.create_from_embeds()
as in the reproducible code section. - Enable select menu by setting
show_select_menu = True
. - Send the paginator, typically through a command context.
Expected Results
Paginator is sent with no errors.
Minimal Reproducible Code
from interactions import Client, Embed, slash_command
from interactions.ext.paginators import Paginator
bot = Client()
@slash_command(name="test")
async def test_cmd(ctx):
embeds = [Embed(title=f"Page {i+1}") for i in range(40)]
paginator = Paginator.create_from_embeds(bot, *embeds)
paginator.show_select_menu = True
await paginator.send(ctx)
bot.start("token")
Traceback
Traceback (most recent call last):
File "...\interactions\client\client.py", line 1903, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "...\interactions\client\client.py", line 1771, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\interactions\models\internal\command.py", line 132, in __call__
await self.call_callback(self.callback, context)
File "...\interactions\models\internal\application_commands.py", line 802, in call_callback
return await self.call_with_binding(callback, ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\interactions\models\internal\callback.py", line 43, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\test.py", line 11, in test_cmd
await paginator.send(ctx)
File "...\interactions\ext\paginators.py", line 369, in send
self._message = await ctx.send(**self.to_dict(), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\interactions\models\internal\context.py", line 531, in send
return await super().send(
^^^^^^^^^^^^^^^^^^^
File "...\interactions\client\mixins\send.py", line 110, in send
message_data = await self._send_http_request(message_payload, files=files or file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\interactions\models\internal\context.py", line 453, in _send_http_request
message_data = await self.client.http.post_initial_response(payload, self.id, self.token, files=files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\interactions\api\http\http_requests\interactions.py", line 149, in post_initial_response
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "...\interactions\api\http\http_client.py", line 454, in request
await self._raise_exception(response, route, result)
File "...\interactions\api\http\http_client.py", line 475, in _raise_exception
raise HTTPException(response, response_data=result, route=route)
interactions.client.errors.HTTPException: HTTPException: 400|Bad Request: data->components->0->components->0->options BASE_TYPE_BAD_LENGTH: Must be between 1 and 25 in length.
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.
- I have attempted to debug this myself, and I believe this issue is with the library
Additional Information
I'm working on a fix using a "scrolling window" of page options. This issue is submitted for traceability.