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

Adds premium interaction docs #6875

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

goatslacker
Copy link
Member

  • Needs new button_styles.png image.

@goatslacker goatslacker added the not released This issue or PR is referencing a change that is not yet widely released and/or subject to change. label May 16, 2024
docs/Change_Log.md Outdated Show resolved Hide resolved
docs/interactions/Message_Components.md Outdated Show resolved Hide resolved

\* Only valid for [component-based](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/) interactions

\*\* Not available for `MODAL_SUBMIT` and `PING` interactions.

\*\*\* Not available for `APPLICATION_COMMAND_AUTOCOMPLETE` and `PING` interactions.
\*\*\* This response type is deprecated. Learn more about [migrating to premium buttons](#DOCS_MONETIZATION_APP_SUBSCRIPTIONS/gating-premium-interactions). Not available for `APPLICATION_COMMAND_AUTOCOMPLETE` and `PING` interactions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may confuse developers that might think that PING/PONG/APPLICATION_COMMAND_AUTOCOMPLETE/APPLICATION_COMMAND_AUTOCOMPLETE_RESULT are deprecated. maybe place it under ****?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a fourth asterisk is a bit much but I do agree the wording is confusing. Maybe this can all look neater too since this is how it currently looks like

Screenshot 2024-05-16 at 3 55 43 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this can all look neater too

I'd agree that putting it in the footnote isn't optimal. Maybe put the deprecation note in a warn box instead...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may confuse developers that might think that PING/PONG/APPLICATION_COMMAND_AUTOCOMPLETE/APPLICATION_COMMAND_AUTOCOMPLETE_RESULT are deprecated.

Made a small change that hopefully makes it more clear. be2df07

Co-authored-by: MCausc78 <mcausc78@gmail.com>
@@ -36,6 +36,33 @@ When a user subscribes to your app, there are a few things you will need to impl

### Gating Premium Interactions

Each interaction payload includes an `entitlements` field containing an array of full [entitlement objects](#DOCS_MONETIZATION_ENTITLEMENTS/entitlement-object). You can use this field to determine if the user or guild is subscribed to your app. If the user or guild is not subscribed and you wish to present them with a means to do so you can use a [button](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/buttons) with a [premium style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) and a `sku_id` attached. You may also use these buttons to present users with options to make a [One-Time Purchase](#DOCS_MONETIZATION_ONE-TIME_PURCHASES).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gets restated below, under Type 10 Interaction Response:

If someone is already subscribed, this command will show the upgrade prompt with a disabled upgrade button. In order to avoid this, your interaction handler should check to see if the user or guild has an active entitlement for your SKU.
Each interaction payload includes an `entitlements` field containing an array of full [entitlement objects](#DOCS_MONETIZATION_ENTITLEMENTS/entitlement-object).
You can use this field to determine if the user or guild is subscribed to your app.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's relevant in both cases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's relevant in both cases.

it just seems redundant, since it's already started once here and then again under the sub header on the same page


#### May 16, 2024

**Premium Apps: New Premium Style for MessageComponentType.BUTTON**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Premium Apps: New Premium Style for MessageComponentType.BUTTON**
**Premium Apps: New Premium Button Style**


**Premium Apps: New Premium Style for MessageComponentType.BUTTON**

This button is to be used with `sku_id` which points to an active SKU. This allows developers to customize their premium experience.
Copy link
Contributor

@valdotle valdotle May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This button is to be used with `sku_id` which points to an active SKU. This allows developers to customize their premium experience.
Introducing a new `premium` [button style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) to be used with a `sku_id` which points to an active [SKU](#DOC_MONETIZATION_SKUS/sku-object). This allows developers to customize their premium experience.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can commit this but we need to change an -> a.

| label? | string | Text that appears on the button; max 80 characters |
| emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) | `name`, `id`, and `animated` |
| custom_id? | string | Developer-defined identifier for the button; max 100 characters |
| sku_id? | snowflake | Identifier for a purchasable SKU, only available when using [ButtonStyle.Premium](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| sku_id? | snowflake | Identifier for a purchasable SKU, only available when using [ButtonStyle.Premium](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) |
| sku_id? | snowflake | Identifier for a purchasable [SKU](#DOC_MONETIZATION_SKUS/sku-object), only available when using premium-style buttons |

| UPDATE_MESSAGE\* | 7 | for components, edit the message the component was attached to |
| APPLICATION_COMMAND_AUTOCOMPLETE_RESULT | 8 | respond to an autocomplete interaction with suggested choices |
| MODAL\*\* | 9 | respond to an interaction with a popup modal |
| PREMIUM_REQUIRED\*\*\* | 10 | [Deprecated](#DOCS_CHANGE_LOG/premium-interactions). respond to an interaction with an upgrade button, only available for apps with monetization enabled |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| PREMIUM_REQUIRED\*\*\* | 10 | [Deprecated](#DOCS_CHANGE_LOG/premium-interactions). respond to an interaction with an upgrade button, only available for apps with monetization enabled |
| PREMIUM_REQUIRED\*\*\* | 10 | [**Deprecated**](#DOCS_CHANGE_LOG/premium-interactions); respond to an interaction with an upgrade button, only available for apps with monetization enabled |

@MCausc78
Copy link
Contributor

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)

@advaith1
Copy link
Contributor

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

@Shuu-37
Copy link

Shuu-37 commented May 28, 2024

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.

goatslacker and others added 2 commits May 29, 2024 17:52
Co-authored-by: codershiba <155646804+codershiba@users.noreply.github.com>
Comment on lines +131 to +132
- 34 characters max with icon or emoji
- 38 characters max without icon or emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency: All the other list items end with a dot.

Suggested change
- 34 characters max with icon or emoji
- 38 characters max without icon or emoji
- 34 characters max with icon or emoji.
- 38 characters max without icon or emoji.

@@ -115,11 +118,46 @@ Buttons come in a variety of styles to convey different types of actions. These
| Success | 3 | green | `custom_id` |
| Danger | 4 | red | `custom_id` |
| Link | 5 | grey, navigates to a URL | `url` |
| Premium | 6 | gradient | `sku_id` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RIP the gradient :(

Suggested change
| Premium | 6 | gradient | `sku_id` |
| Premium | 6 | blurple | `sku_id` |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not released This issue or PR is referencing a change that is not yet widely released and/or subject to change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants