Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Webhook cannot execute stickers #1734

Open
4 tasks done
retr0-init opened this issue Aug 26, 2024 · 1 comment
Open
4 tasks done

[BUG] Webhook cannot execute stickers #1734

retr0-init opened this issue Aug 26, 2024 · 1 comment

Comments

@retr0-init
Copy link
Contributor

retr0-init commented Aug 26, 2024

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

  • 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

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

@retr0-init
Copy link
Contributor Author

I suggest the sticker parameter to be removed all together.

Additionally, the type hint of the parameter only works for list. I won't bother creating another issue as this won't be necessary as this field is deleted

@interactions-py interactions-py deleted a comment from Saschl Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@retr0-init and others