Skip to content

Commit b48d895

Browse files
committed
test: playground
1 parent c64e65e commit b48d895

File tree

7 files changed

+34
-19
lines changed

7 files changed

+34
-19
lines changed

playground/commands/moderations/ban.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { defineCommand } from '../../../src'
22

33
export default defineCommand(
44
{
5-
slash: true,
65
description: 'Ban a user from the server',
7-
args: {
6+
options: {
87
user: {
98
type: 'User',
109
description: 'The user to ban'
@@ -17,7 +16,7 @@ export default defineCommand(
1716
userPermissions: ['Administrator']
1817
},
1918
(_, interaction, context) => {
20-
const { user, reason } = context.args
19+
const { user, reason } = context.options
2120

2221
interaction.reply(`Banned user ${user} for ${reason}`)
2322
}

playground/commands/moderations/kick.slash.ts renamed to playground/commands/moderations/kick.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineCommand } from '../../../src'
33
export default defineCommand(
44
{
55
description: 'Kick a user from the server',
6-
args: {
6+
options: {
77
user: {
88
type: 'User',
99
description: 'The user to ban'
@@ -15,7 +15,7 @@ export default defineCommand(
1515
}
1616
},
1717
(_, interaction, context) => {
18-
const { user, reason } = context.args
18+
const { user, reason } = context.options
1919

2020
interaction.reply(`Kicked user ${user} for ${reason}`)
2121
}

playground/commands/utils/noop.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
import { defineCommand } from '../../../src'
1+
import { defineCommand, defineEmbed } from '../../../src'
22

33
export default defineCommand(
44
{
5-
slash: false,
6-
description: 'NOOP!'
5+
description: 'NOOP!',
6+
options: {
7+
noop: {
8+
type: 'User',
9+
description: 'Noop user',
10+
required: false
11+
}
12+
}
713
},
8-
(_, message) => {
9-
message.reply('NOOP')
14+
(_, interaction, context) => {
15+
const { noop } = context.options
16+
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] })
1027
}
1128
)

playground/commands/utils/ping.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { defineCommand } from '../../../src'
22

33
export default defineCommand(
44
{
5-
slash: false,
65
description: 'Pong!'
76
},
8-
(client, message) => {
9-
message.reply(`Pong ${client.ws.ping}ms!`)
7+
(client, interaction) => {
8+
interaction.reply(`Pong ${client.ws.ping}ms!`)
109
}
1110
)

playground/commands/utils/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { defineCommand, defineModal } from '../../../src'
33

44
export default defineCommand(
55
{
6-
slash: true,
76
description: 'Test the bot',
7+
guildOnly: true,
88
preconditions: ['ownerOnly']
99
},
1010
async (_, interaction) => {

playground/harmonix.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineHarmonixConfig } from '../src'
22

33
export default defineHarmonixConfig({
4-
ownerId: ['556083802628161546']
4+
ownerId: ['556083802628161546'],
5+
guildId: ['725902714311278643']
56
})

playground/preconditions/ownerOnly.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { definePrecondition, useHarmonix } from '../../src'
22

3-
export default definePrecondition(({ type, message, interaction }) => {
3+
export default definePrecondition(({ interaction }) => {
44
const harmonix = useHarmonix()
5-
const entity = type === 'message' ? message : interaction
6-
const authorId = entity.member?.user.id
5+
const authorId = interaction.member?.user.id
76

87
if (authorId && !harmonix.options.ownerId.includes(authorId)) {
9-
entity?.reply('You are not the owner of this bot!')
8+
interaction?.reply('You are not the owner of this bot!')
109
return false
1110
}
1211
return true

0 commit comments

Comments
 (0)