File tree 7 files changed +57
-48
lines changed
7 files changed +57
-48
lines changed Original file line number Diff line number Diff line change
1
+ import { defineButton } from '../../src'
2
+
3
+ export default defineButton (
4
+ {
5
+ label : 'Say hello!' ,
6
+ style : 'Primary'
7
+ } ,
8
+ ( interaction ) => {
9
+ interaction . reply ( 'Hello!' )
10
+ }
11
+ )
Original file line number Diff line number Diff line change 1
- import { defineCommand , defineEmbed } from '../../../src'
1
+ import { defineCommand , getSelectMenu , useActionRow } from '../../../src'
2
2
3
3
export default defineCommand (
4
4
{
5
- description : 'NOOP!' ,
6
- options : {
7
- noop : {
8
- type : 'User' ,
9
- description : 'Noop user' ,
10
- required : false
11
- }
12
- }
5
+ description : 'NOOP!'
13
6
} ,
14
- ( _ , interaction , context ) => {
15
- const { noop } = context . options
7
+ ( _ , interaction ) => {
8
+ const selectMenu = getSelectMenu ( 'choose' )
9
+ const row = useActionRow ( selectMenu ! )
16
10
17
- const embed = defineEmbed ( {
18
- color : 0x0099ff ,
19
- title : 'Noop title' ,
20
- description : `Noop description here ${ noop } ` ,
21
- thumbnail :
22
- 'https://tr.rbxcdn.com/dd80ef8b8f6ecc3ffd54b4bffbb91af4/420/420/Image/Png' ,
23
- timestamp : new Date ( )
24
- } )
25
-
26
- interaction . reply ( { embeds : [ embed ] } )
11
+ interaction . reply ( { content : 'Say hello:' , components : [ row ] } )
27
12
}
28
13
)
Original file line number Diff line number Diff line change 1
- import { TextInputStyle } from 'discord.js'
2
- import { defineCommand , defineModal } from '../../../src'
1
+ import { defineCommand , getModal } from '../../../src'
3
2
4
3
export default defineCommand (
5
4
{
6
5
description : 'Test the bot' ,
7
- guildOnly : true ,
8
6
preconditions : [ 'ownerOnly' ]
9
7
} ,
10
8
async ( _ , interaction ) => {
11
- const modal = defineModal ( {
12
- id : 'test' ,
13
- title : 'Test' ,
14
- textInputs : [
15
- {
16
- id : 'color' ,
17
- label : 'Color' ,
18
- style : TextInputStyle . Short ,
19
- placeholder : 'Enter a color'
20
- } ,
21
- {
22
- id : 'hobbies' ,
23
- label : 'Hobbies' ,
24
- style : TextInputStyle . Paragraph ,
25
- placeholder : 'Enter your hobbies'
26
- }
27
- ]
28
- } )
9
+ const modal = getModal ( 'form' )
29
10
30
- await interaction . showModal ( modal )
11
+ await interaction . showModal ( modal ! )
31
12
}
32
13
)
Load Diff This file was deleted.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import { defineModal } from '../../src'
2
+
3
+ export default defineModal (
4
+ {
5
+ title : 'Form' ,
6
+ textInputs : [
7
+ {
8
+ id : 'color' ,
9
+ label : 'Favorite color' ,
10
+ placeholder : 'Enter your favorite color' ,
11
+ style : 'Short'
12
+ } ,
13
+ {
14
+ id : 'hobbies' ,
15
+ label : 'Hobbies' ,
16
+ placeholder : 'Enter your hobbies' ,
17
+ style : 'Paragraph'
18
+ }
19
+ ]
20
+ } ,
21
+ ( interaction ) => {
22
+ const color = interaction . fields . getTextInputValue ( 'color' )
23
+
24
+ interaction . reply ( `Submitted color: ${ color } ` )
25
+ }
26
+ )
Original file line number Diff line number Diff line change
1
+ import { defineSelectMenu } from '../../src'
2
+
3
+ export default defineSelectMenu (
4
+ {
5
+ type : 'User' ,
6
+ placeholder : 'Choose a user'
7
+ } ,
8
+ ( interaction ) => {
9
+ interaction . reply ( `You selected an user!` )
10
+ }
11
+ )
You can’t perform that action at this time.
0 commit comments