Skip to content

Commit

Permalink
Merge pull request #21 from twlite/reactivity-boi
Browse files Browse the repository at this point in the history
feat: add signal and buttonkit
  • Loading branch information
notunderctrl authored Oct 26, 2023
2 parents 0bd131c + ce59f5a commit d57c462
Show file tree
Hide file tree
Showing 11 changed files with 852 additions and 4 deletions.
4 changes: 3 additions & 1 deletion apps/docs/pages/docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"command-file-setup": "Commands Setup",
"event-file-setup": "Events Setup",
"validation-file-setup": "Validations Setup",
"migrating-from-djs-commander": "Migrating from DJS-Commander"
"migrating-from-djs-commander": "Migrating from DJS-Commander",
"buttonkit-example": "ButtonKit Example",
"using-signal": "Using Signal"
}
77 changes: 77 additions & 0 deletions apps/docs/pages/docs/button-kit.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { Tabs } from 'nextra/components';

# ButtonKit

ButtonKit is a class that allows you to use buttons easily by extending native [ButtonBuilder](https://old.discordjs.dev/#/docs/discord.js/main/class/ButtonBuilder) features.

## Usage

<Tabs items={['CommonJS', 'ESM', 'TypeScript']}>
<Tabs.Tab>
```js filename="commands/counter.js" copy
const { ButtonKit } = require('commandkit');
const { ButtonStyle } = require('discord.js');

// create a button
const button = new ButtonKit()
.setEmoji('👍')
.setStyle(ButtonStyle.Primary)
// custom id is required to use onClick
.setCustomId('button');

// listen to the button interaction right away
button.onClick(
(interaction) => {
// reply to the interaction
interaction.reply('You clicked the button!');
},
{ message },
);
```
</Tabs.Tab>
<Tabs.Tab>
```js filename="commands/counter.js" copy
import { ButtonKit } from 'commandkit';
import { ButtonStyle } from 'discord.js';

// create a button
const button = new ButtonKit()
.setEmoji('👍')
.setStyle(ButtonStyle.Primary)
// custom id is required to use onClick
.setCustomId('button');

// listen to the button interaction right away
button.onClick(
(interaction) => {
// reply to the interaction
interaction.reply('You clicked the button!');
},
{ message },
);
```
</Tabs.Tab>
<Tabs.Tab>
```ts filename="commands/counter.ts" copy
import { ButtonKit } from 'commandkit';
import { ButtonStyle, ButtonInteraction } from 'discord.js';

// create a button
const button = new ButtonKit()
.setEmoji('👍')
.setStyle(ButtonStyle.Primary)
// custom id is required to use onClick
.setCustomId('button');

// listen to the button interaction right away
button.onClick(
(interaction: ButtonInteraction) => {
// reply to the interaction
interaction.reply('You clicked the button!');
},
{ message },
);
```
</Tabs.Tab>

</Tabs>
Loading

0 comments on commit d57c462

Please sign in to comment.