-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.ts
54 lines (49 loc) · 1.47 KB
/
commands.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
50
51
52
53
54
import "jsr:@std/dotenv/load";
import { InstallGlobalCommands } from "./utils.ts";
import {
APIApplicationCommand,
ApplicationCommandOptionType,
ApplicationCommandType,
ApplicationIntegrationType,
InteractionContextType,
} from "https://deno.land/x/discord_api_types@0.37.101/v10.ts";
// Define commands
const TEST_COMMAND: Partial<APIApplicationCommand> = {
name: "test",
description: "Basic command",
type: ApplicationCommandType.ChatInput,
dm_permission: true,
default_member_permissions: null,
nsfw: false,
integration_types: [ApplicationIntegrationType.GuildInstall],
contexts: [InteractionContextType.Guild, InteractionContextType.BotDM],
};
const ECHO_COMMAND: Partial<APIApplicationCommand> = {
name: "echo",
description: "Repeats your message",
type: ApplicationCommandType.ChatInput,
dm_permission: true,
default_member_permissions: null,
nsfw: false,
integration_types: [ApplicationIntegrationType.GuildInstall],
contexts: [InteractionContextType.Guild, InteractionContextType.BotDM],
options: [
{
type: ApplicationCommandOptionType.String,
name: "message",
description: "The message to repeat",
required: true,
},
],
};
const ALL_COMMANDS: Partial<APIApplicationCommand>[] = [
TEST_COMMAND,
ECHO_COMMAND,
];
// Install commands
const APP_ID = Deno.env.get("APP_ID");
if (!APP_ID) {
console.error("Missing APP_ID environment variable");
Deno.exit(1);
}
await InstallGlobalCommands(APP_ID, ALL_COMMANDS);