interactions.py icon indicating copy to clipboard operation
interactions.py copied to clipboard

[BUG] Webhook cannot execute stickers

Open retr0-init opened this issue 1 year ago • 1 comments

Library Version

5.13.1

Describe the Bug

The discord webhook execution API does not contain the sticker field according to https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params.

Steps to Reproduce

  1. Create a custom sticker
  2. Execute the following code to send the sticker with webhook

Expected Results

It complains empty content sent with webhook

Minimal Reproducible Code

class TemplateCog(interactions.Extension):
    @interactions.slash_command(
        "test", description="test command", scopes=[DEV_GUILD] if DEV_GUILD else None
    )
    async def test_cmd(self, ctx: interactions.SlashContext):
        """Register as an extension command"""
        a = await ctx.channel.fetch_webhooks()
        sticker = await ctx.guild.fetch_all_custom_stickers()
        await a[0].send(username="ABCDEFG", avatar_url=ctx.author.avatar_url, stickers=sticker)

Traceback

Traceback (most recent call last):
  File "venv/lib/python3.11/site-packages/interactions/client/client.py", line 2018, in __dispatch_interaction
    response = await callback
               ^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/interactions/client/client.py", line 1886, in _run_slash_command
    return await command(ctx, **ctx.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/interactions/models/internal/command.py", line 132, in __call__
    await self.call_callback(self.callback, context)
  File "venv/lib/python3.11/site-packages/interactions/models/internal/application_commands.py", line 841, in call_callback
    return await self.call_with_binding(callback, ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/interactions/models/internal/callback.py", line 44, in call_with_binding
    return await callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "extensions/template.py", line 26, in test_cmd
    await ctx.send(f"{ctx.channel.name}")
  File "venv/lib/python3.11/site-packages/interactions/models/discord/webhooks.py", line 255, in send
    message_data = await self._client.http.execute_webhook(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/interactions/api/http/http_requests/webhooks.py", line 150, in execute_webhook
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/interactions/api/http/http_client.py", line 467, in request
    await self._raise_exception(response, route, result)
  File "venv/lib/python3.11/site-packages/interactions/api/http/http_client.py", line 488, in _raise_exception
    raise HTTPException(response, response_data=result, route=route)
interactions.client.errors.HTTPException: HTTPException: 400|Bad Request || Cannot send an empty message

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.
  • [X] I have attempted to debug this myself, and I believe this issue is with the library

Additional Information

https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

retr0-init avatar Aug 26 '24 15:08 retr0-init