harmony/test/slash.ts
2021-04-04 11:22:47 +05:30

64 lines
1.4 KiB
TypeScript

import {
Client,
Intents,
event,
slash,
SlashCommandOptionType as Type
} from '../../mod.ts'
import { Interaction } from '../structures/slash.ts'
import { TOKEN } from './config.ts'
export class MyClient extends Client {
@event() ready(): void {
console.log(`Logged in as ${this.user?.tag}!`)
this.slash.commands.bulkEdit(
[
{
name: 'test',
description: 'Test command.',
options: [
{
name: 'user',
type: Type.USER,
description: 'User'
},
{
name: 'role',
type: Type.ROLE,
description: 'Role'
},
{
name: 'channel',
type: Type.CHANNEL,
description: 'Channel'
},
{
name: 'string',
type: Type.STRING,
description: 'String'
}
]
}
],
'807935370556866560'
)
this.slash.commands.bulkEdit([])
}
@slash() test(d: Interaction): void {
console.log(d.resolved)
}
@event() raw(evt: string, d: any): void {
if (evt === 'INTERACTION_CREATE') console.log(evt, d?.data?.resolved)
}
}
const client = new MyClient({
presence: {
status: 'dnd',
activity: { name: 'Slash Commands', type: 'LISTENING' }
}
})
client.connect(TOKEN, Intents.None)