Skip to content

Commit d39952e

Browse files
committed
test: playground
1 parent 1339153 commit d39952e

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

playground/commands/utils/test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { defineCommand, defineModal } from '../../../src'
44
export default defineCommand(
55
{
66
slash: true,
7-
description: 'Test the bot'
7+
description: 'Test the bot',
8+
preconditions: ['ownerOnly']
89
},
910
async (_, interaction) => {
1011
const modal = defineModal({

playground/preconditions/nsfw.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { definePrecondition, useHarmonix } from '../../src'
2+
3+
export default definePrecondition(({ type, message, interaction }) => {
4+
const harmonix = useHarmonix()
5+
const entity = type === 'message' ? message : interaction
6+
const authorId = entity.member?.user.id
7+
8+
if (authorId && !harmonix.options.ownerId.includes(authorId)) {
9+
entity?.reply('You are not the owner of this bot!')
10+
return false
11+
}
12+
return true
13+
})

0 commit comments

Comments
 (0)