Skip to content

Commit 1a669ec

Browse files
committed
test: playground
1 parent b6e00d0 commit 1a669ec

File tree

4 files changed

+17
-30
lines changed

4 files changed

+17
-30
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { CommandInteractionOption } from 'discord.js'
2-
import { defineCommand, defineArgument, useArguments } from '../../../src'
1+
import { defineCommand, defineArgument } from '../../../src'
32

43
export default defineCommand(
54
{
@@ -10,14 +9,17 @@ export default defineCommand(
109
type: 'User',
1110
name: 'user',
1211
description: 'The user to ban'
12+
}),
13+
defineArgument({
14+
type: 'String',
15+
name: 'reason',
16+
description: 'The reason for the ban'
1317
})
1418
]
1519
},
1620
(_, interaction, options) => {
17-
const { get } = useArguments(options)
21+
const { user, reason } = options.args
1822

19-
interaction.reply(
20-
`Banned user ${get<CommandInteractionOption>('user').user?.username}`
21-
)
23+
interaction.reply(`Banned user ${user} for ${reason}`)
2224
}
2325
)

playground/commands/moderations/kick.slash.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineArgument, defineCommand } from '../../../src'
2-
import { CommandArgType } from '../../../src/types'
32

43
export default defineCommand(
54
{
@@ -17,7 +16,9 @@ export default defineCommand(
1716
})
1817
]
1918
},
20-
(_, message) => {
21-
message.reply('Kicked user')
19+
(_, interaction, options) => {
20+
const { user, reason } = options.args
21+
22+
interaction.reply(`Kicked user ${user} for ${reason}`)
2223
}
2324
)

playground/commands/utils/ping.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
import { defineArgument, defineCommand, useArguments } from '../../../src'
1+
import { defineCommand } from '../../../src'
22

33
export default defineCommand(
44
{
55
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+
description: 'Pong!'
197
},
20-
(client, message, options) => {
21-
const { get } = useArguments(options)
22-
23-
message.reply(`Pong ${client.ws.ping}ms! ${get<string>('user')}`)
8+
(client, message) => {
9+
message.reply(`Pong ${client.ws.ping}ms!`)
2410
}
2511
)

playground/commands/utils/test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ export default defineCommand(
44
{
55
description: 'Test the bot'
66
},
7-
() => {
8-
console.log('Tested the bot')
9-
}
7+
() => console.log('Tested the bot')
108
)

0 commit comments

Comments
 (0)