discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Adds premium interaction docs

Open goatslacker opened this issue 1 year ago • 1 comments
trafficstars

  • [ ] Needs new button_styles.png image.

goatslacker avatar May 16 '24 19:05 goatslacker

Why custom_id is required when using style 6? Just curious, if docs say only "sku_id" is required.

Traceback (most recent call last):
  File "/home/***/venv/lib/python3.10/site-packages/jishaku/features/python.py", line 190, in jsk_python
    async for send, result in AsyncSender(executor):  # type: ignore
  File "/home/***/venv/lib/python3.10/site-packages/jishaku/functools.py", line 124, in _internal
    value = await base.asend(self.send_value)
  File "/home/***/venv/lib/python3.10/site-packages/jishaku/repl/compilation.py", line 210, in traverse
    async for send, result in AsyncSender(func_g(*self.args)):  # type: ignore
  File "/home/***/venv/lib/python3.10/site-packages/jishaku/functools.py", line 124, in _internal
    value = await base.asend(self.send_value)
  File "<repl>", line 15, in _repl_coroutine
    await _bot.http.request(
  File "/home/***/venv/lib/python3.10/site-packages/discord/http.py", line 758, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.sku_id: Invalid SKU
In components.0.components.0.custom_id: A custom id is required

components = [
  {
    'type': 1, 'components': [
      {
        'type': 2,
        'style': 6,
        'sku_id': '521847234246082599', # nitro sku id (maybe)
        'label': 'wdhsjshjs',
      }
    ]
  }
]

await _bot.http.request(
  discord.http.Route('POST',
    '/channels/{channel_id}/messages',
    channel_id=_channel.id
  ), json={
  'content': 'Hello world',
  'components': components
})

(Unverified bot)

MCausc78 avatar May 17 '24 10:05 MCausc78

Why are custom labels not supported for premium buttons? That's unfortunate for bots that want to provide multiple options in the response

advaith1 avatar May 28 '24 21:05 advaith1

Why are custom labels not supported for premium buttons? That's unfortunate for bots that want to provide multiple options in the response

They can still have multiple buttons in a response. But we want clarity in each of the premium buttons and requiring sku_name & price is the best path forward right now. It's possible we can open this up in the future to not require sku name & price.

Shuu-37 avatar May 28 '24 22:05 Shuu-37

if the image is being updated, might as well update the other buttons in it too - the green and maybe the red are outdated colors, and the grays are inconsistent

advaith1 avatar Jun 15 '24 00:06 advaith1

if the image is being updated, might as well update the other buttons in it too - the green and maybe the red are outdated colors, and the grays are inconsistent

Agree, I'll get those other colors updated. Thanks Advaith!

Shuu-37 avatar Jun 15 '24 04:06 Shuu-37