-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ts
49 lines (42 loc) · 1.3 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Client, CommandInteraction, InteractionReplyOptions, MessagePayload } from 'discord.js';
const client = new Client({
allowedMentions: {
parse: ['everyone'],
},
intents: [],
});
client.on('ready', async () => {
client.user?.setActivity('daily stw gifts', { type: 'WATCHING' });
//client.guilds.cache.get('guildId').commands.set
if (!client.application) return console.log('No application found');
await client.application.commands.set([
{
'name': 'claimreward',
'description': 'Claims a reward from the daily stw gifts',
'options': [{
'name': 'authcode',
'type': 'STRING',
'required': true,
'description': 'The authorization code from the daily stw gifts',
}]
},
{
'name': 'intro',
'description': 'Shows how to use claimreward',
'options': [],
}
]);
})
client.on('interactionCreate', async (i:any) => {
const interaction = i as CommandInteraction;
if(!i.isCommand) return;
switch (interaction.commandName) {
case 'claimreward':
import('./commands/claim').then((z) => z.default(interaction));
return;
case 'intro':
import('./commands/intro').then((z) => z.default(interaction));
return;
}
})
client.login("OTY5MDI1MTE5ODkwNTk5OTk2.YmnY-A.CyN_2pY7hBDNPbRlUyGUot22fN0");