harmony/test/slash.ts

65 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-02-12 11:37:38 +00:00
import {
Client,
Intents,
event,
slash,
SlashCommandOptionType as Type
} from '../../mod.ts'
import { Interaction } from '../structures/slash.ts'
2020-12-10 04:36:36 +00:00
import { TOKEN } from './config.ts'
export class MyClient extends Client {
2021-02-12 11:37:38 +00:00
@event() ready(): void {
console.log(`Logged in as ${this.user?.tag}!`)
2021-02-12 11:37:38 +00:00
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'
}
]
2020-12-10 06:55:52 +00:00
}
2021-02-12 11:37:38 +00:00
],
'807935370556866560'
)
this.slash.commands.bulkEdit([])
}
2021-02-12 11:37:38 +00:00
@slash() test(d: Interaction): void {
console.log(d.resolved)
2020-12-10 10:42:03 +00:00
}
2021-02-12 11:37:38 +00:00
@event() raw(evt: string, d: any): void {
if (evt === 'INTERACTION_CREATE') console.log(evt, d?.data?.resolved)
2020-12-10 10:42:03 +00:00
}
}
2020-12-10 04:36:36 +00:00
2021-01-07 13:46:56 +00:00
const client = new MyClient({
presence: {
status: 'dnd',
activity: { name: 'Slash Commands', type: 'LISTENING' }
}
})
2020-12-10 04:36:36 +00:00
client.connect(TOKEN, Intents.None)