File tree Expand file tree Collapse file tree 5 files changed +53
-16
lines changed Expand file tree Collapse file tree 5 files changed +53
-16
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,7 @@ import { createHarmony } from '../dist/index.mjs'
4
4
import 'dotenv/config'
5
5
6
6
const initHarmony = async ( ) => {
7
- const harmony = await createHarmony (
8
- { rootDir : './playground' } ,
9
- { cwd : './playground' }
10
- )
11
- console . log ( harmony )
7
+ await createHarmony ( { rootDir : './playground' } , { cwd : './playground' } )
12
8
}
13
9
14
10
initHarmony ( )
Original file line number Diff line number Diff line change 1
- import { defineCommand } from '../../../src'
1
+ import type { CommandInteractionOption } from 'discord.js'
2
+ import { defineCommand , defineArgument , useArguments } from '../../../src'
2
3
3
4
export default defineCommand (
4
5
{
5
6
slash : true ,
6
- description : 'Ban a user from the server'
7
+ description : 'Ban a user from the server' ,
8
+ args : [
9
+ defineArgument ( {
10
+ type : 'User' ,
11
+ name : 'user' ,
12
+ description : 'The user to ban'
13
+ } )
14
+ ]
7
15
} ,
8
- ( _ , interaction ) => {
9
- interaction . reply ( 'Banned user' )
16
+ ( _ , interaction , options ) => {
17
+ const { get } = useArguments ( options )
18
+
19
+ interaction . reply (
20
+ `Banned user ${ get < CommandInteractionOption > ( 'user' ) . user ?. username } `
21
+ )
10
22
}
11
23
)
Original file line number Diff line number Diff line change 1
- import { defineCommand } from '../../../src'
1
+ import { defineArgument , defineCommand } from '../../../src'
2
+ import { CommandArgType } from '../../../src/types'
2
3
3
4
export default defineCommand (
4
5
{
5
- description : 'Kick a user from the server'
6
+ description : 'Kick a user from the server' ,
7
+ args : [
8
+ defineArgument ( {
9
+ type : 'User' ,
10
+ name : 'user' ,
11
+ description : 'The user to kick'
12
+ } ) ,
13
+ defineArgument ( {
14
+ type : 'String' ,
15
+ name : 'reason' ,
16
+ description : 'The reason for the kick'
17
+ } )
18
+ ]
6
19
} ,
7
20
( _ , message ) => {
8
21
message . reply ( 'Kicked user' )
Original file line number Diff line number Diff line change 1
- import { defineCommand } from '../../../src'
1
+ import { defineArgument , defineCommand , useArguments } from '../../../src'
2
2
3
3
export default defineCommand (
4
4
{
5
- description : 'Pong!'
5
+ slash : false ,
6
+ description : 'Pong!' ,
7
+ args : [
8
+ defineArgument ( {
9
+ type : 'String' ,
10
+ name : 'message' ,
11
+ description : 'The message to send'
12
+ } ) ,
13
+ defineArgument ( {
14
+ type : 'String' ,
15
+ name : 'user' ,
16
+ description : 'The user to ping'
17
+ } )
18
+ ]
6
19
} ,
7
- ( client , message ) => {
8
- message . reply ( 'Pong ' + client . ws . ping + 'ms!' )
20
+ ( client , message , options ) => {
21
+ const { get } = useArguments ( options )
22
+
23
+ message . reply ( `Pong ${ client . ws . ping } ms! ${ get < string > ( 'user' ) } ` )
9
24
}
10
25
)
Original file line number Diff line number Diff line change 1
1
import { defineHarmonyConfig } from '../src'
2
2
3
3
export default defineHarmonyConfig ( {
4
- defaultPrefix : 'h!'
4
+ defaultPrefix : 'h!' ,
5
+ clientId : '929023549656662047'
5
6
} )
You can’t perform that action at this time.
0 commit comments