Skip to content

Commit 9401374

Browse files
committed
feat: update templates to have buttons
1 parent 16980e0 commit 9401374

File tree

9 files changed

+83
-28
lines changed

9 files changed

+83
-28
lines changed

.changeset/mean-fans-explode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-jellycommands': minor
3+
---
4+
5+
update templates to have buttons
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { button } from 'jellycommands';
2+
3+
export default button({
4+
id: 'hello',
5+
6+
async run({ interaction }) {
7+
interaction.reply({
8+
content: 'Hello from a button!',
9+
});
10+
},
11+
});

packages/create-jellycommands/src/js/src/commands/hello.js

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
2+
import { command } from 'jellycommands';
3+
4+
export default command({
5+
name: 'test',
6+
description: 'Testing that the bot works fine',
7+
8+
global: true,
9+
10+
run: ({ interaction }) => {
11+
const row = new ActionRowBuilder();
12+
13+
const button = new ButtonBuilder()
14+
.setCustomId('hello')
15+
.setLabel('Click me!')
16+
.setStyle(ButtonStyle.Primary);
17+
18+
row.addComponents(button);
19+
20+
interaction.reply({
21+
content: 'Hello, world!',
22+
components: [row],
23+
});
24+
},
25+
});

packages/create-jellycommands/src/js/src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const client = new JellyCommands({
99
// https://jellycommands.dev/guide/events/loading
1010
events: 'src/events',
1111

12+
// https://jellycommands.dev/guide/buttons/loading
13+
buttons: 'src/buttons',
14+
1215
clientOptions: {
1316
intents: [IntentsBitField.Flags.Guilds],
1417
},
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { button } from 'jellycommands';
2+
3+
export default button({
4+
id: 'hello',
5+
6+
async run({ interaction }) {
7+
interaction.reply({
8+
content: 'Hello from a button!',
9+
});
10+
},
11+
});

packages/create-jellycommands/src/ts/src/commands/hello.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
2+
import { command } from 'jellycommands';
3+
4+
export default command({
5+
name: 'test',
6+
description: 'Testing that the bot works fine',
7+
8+
global: true,
9+
10+
run: ({ interaction }) => {
11+
const row = new ActionRowBuilder<ButtonBuilder>();
12+
13+
const button = new ButtonBuilder()
14+
.setCustomId('hello')
15+
.setLabel('Click me!')
16+
.setStyle(ButtonStyle.Primary);
17+
18+
row.addComponents(button);
19+
20+
interaction.reply({
21+
content: 'Hello, world!',
22+
components: [row],
23+
});
24+
},
25+
});

packages/create-jellycommands/src/ts/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const client = new JellyCommands({
99
// https://jellycommands.dev/guide/events/loading
1010
events: 'src/events',
1111

12+
// https://jellycommands.dev/guide/buttons/loading
13+
buttons: 'src/buttons',
14+
1215
clientOptions: {
1316
intents: [IntentsBitField.Flags.Guilds],
1417
},

0 commit comments

Comments
 (0)