File tree Expand file tree Collapse file tree 20 files changed +169
-75
lines changed
Expand file tree Collapse file tree 20 files changed +169
-75
lines changed Original file line number Diff line number Diff line change 1- import { defineCommand } from '../../src'
1+ import { defineCommand , useActionRow , useButtons } from '../../src'
22
33export default defineCommand (
44 {
@@ -24,13 +24,15 @@ export default defineCommand(
2424 }
2525 }
2626 } ,
27- ( _ , interaction , ctx ) => {
27+ ( interaction , ctx ) => {
2828 const { user, server } = ctx . options
29+ const { hello } = useButtons ( )
30+ const row = useActionRow ( hello ! , hello ! )
2931
3032 if ( user ) {
31- return interaction . reply ( 'User info' )
33+ return interaction . reply ( { content : 'User info' , components : [ row ] } )
3234 } else if ( server ) {
33- return interaction . reply ( 'Server info' )
35+ return interaction . reply ( { content : 'Server info' , components : [ row ] } )
3436 }
3537 }
3638)
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default defineCommand(
1616 } ,
1717 userPermissions : [ 'Administrator' ]
1818 } ,
19- async ( _ , interaction , ctx ) => {
19+ async ( interaction , ctx ) => {
2020 const { user, reason } = ctx . options
2121
2222 interaction . reply ( `Banned user ${ user } for ${ reason } ` )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default defineCommand(
1515 }
1616 }
1717 } ,
18- ( _ , interaction , context ) => {
18+ ( interaction , context ) => {
1919 const { user, reason } = context . options
2020
2121 interaction . reply ( `Kicked user ${ user } for ${ reason } ` )
Original file line number Diff line number Diff line change 1- import { defineCommand , getSelectMenu , useActionRow } from '../../../src'
1+ import { defineCommand , useActionRow , useSelectMenus } from '../../../src'
22
33export default defineCommand (
44 {
55 description : 'NOOP!' ,
66 dm : true
77 } ,
8- ( _ , interaction ) => {
9- const selectMenu = getSelectMenu ( 'choose' )
10- const row = useActionRow ( selectMenu ! )
8+ ( interaction ) => {
9+ const { choose } = useSelectMenus ( )
10+ const row = useActionRow ( choose )
1111
1212 interaction . reply ( { content : 'Noop' , components : [ row ] } )
1313 }
Original file line number Diff line number Diff line change 1- import { defineCommand } from '../../../src'
1+ import { defineCommand , useHarmonix } from '../../../src'
22
33export default defineCommand (
44 {
55 description : 'Pong!'
66 } ,
7- ( client , interaction ) => {
7+ ( interaction ) => {
8+ const { client } = useHarmonix ( )
9+
810 interaction . reply ( `Pong ${ client . ws . ping } ms!` )
911 }
1012)
Original file line number Diff line number Diff line change 1- import { defineCommand , getModal } from '../../../src'
1+ import { defineCommand , useModals } from '../../../src'
22
33export default defineCommand (
44 {
55 description : 'Test the bot' ,
66 preconditions : [ 'ownerOnly' ]
77 } ,
8- async ( _ , interaction ) => {
9- const modal = getModal ( 'form' )
8+ async ( interaction ) => {
9+ const { form } = useModals ( )
1010
11- await interaction . showModal ( modal ! )
11+ await interaction . showModal ( form ! )
1212 }
1313)
Original file line number Diff line number Diff line change @@ -3,11 +3,10 @@ import { defineContextMenu } from '../../src'
33export default defineContextMenu (
44 {
55 name : 'Get message author' ,
6+ type : 'Message' ,
67 preconditions : [ 'ownerOnly' ]
78 } ,
8- ( interaction ) => {
9- interaction . reply (
10- `This message has been sent by ${ interaction . targetMessage . author } `
11- )
9+ async ( interaction , target ) => {
10+ await interaction . reply ( `This message has been sent by ${ target . author } ` )
1211 }
1312)
Original file line number Diff line number Diff line change @@ -5,11 +5,13 @@ export default defineSelectMenu(
55 type : 'User' ,
66 placeholder : 'Choose a user'
77 } ,
8- ( interaction ) => {
8+ async ( interaction , selected ) => {
9+ const member = await interaction . guild ?. members . fetch ( selected [ 0 ] )
910 const embed = useEmbed ( {
1011 color : 0x2c2d31 ,
11- description : `You selected ${ interaction . users . first ( ) } !`
12+ description : `You selected ${ member ?. user } !`
1213 } )
14+
1315 interaction . reply ( { embeds : [ embed ] } )
1416 }
1517)
Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ export const helpCommand = defineCommand(
4444 return interaction . respond ( options )
4545 }
4646 } ,
47- async ( client , interaction , ctx ) => {
47+ async ( interaction , ctx ) => {
4848 const { command } = ctx . options
49- const { commands } = useHarmonix ( )
49+ const { client , commands } = useHarmonix ( )
5050
5151 if ( ! command ) {
5252 const groupedCommands = groupCommandsByCategory (
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export const defineEvent: DefineEvent = <
6161}
6262
6363export const defineCommand = < T extends OptionsDef = OptionsDef > (
64- config : CommandConfig & { options ?: T } ,
64+ config : Omit < CommandConfig < T > , 'id' > & { options ?: T } ,
6565 execute : CommandExecute < T >
6666) : HarmonixCommand < T > => {
6767 for ( const [ key , value ] of Object . entries ( config . options ?? { } ) ) {
@@ -77,7 +77,7 @@ export const defineCommand = <T extends OptionsDef = OptionsDef>(
7777}
7878
7979export const defineContextMenu : DefineContextMenu = <
80- T extends ContextMenuType = 'Message'
80+ T extends ContextMenuType = ContextMenuType
8181> (
8282 ...args : [
8383 ( ContextMenuConfig & { type ?: T } ) | ContextMenuCallback < T > ,
You can’t perform that action at this time.
0 commit comments