Button
Create a Button
To create a button in your project, it is recommended to use the provided CLI tool. This will ensure that your button is correctly generated and ready to implement.
CLI Pattern
Example
For a "buy" button, you can obtain the following file at src/buttons/buy.ts
, ready for implementation.
Define Button Parameters
Once the button is created, you can define any parameters the button will receive. Here’s an example of a "buy" button that takes an article
and a quantity
as parameters:
Using the Button
After creating the button handler, you can instantiate and use the button in your bot’s interactions. Here is an example of how to send a button within a message:
You can also use the button from an external function:
Last updated