-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.ts
59 lines (52 loc) · 1.86 KB
/
index.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
55
56
57
58
59
import type ClientInstance from '@/loaders/client';
import type {
ChatInputCommandInteraction,
ColorResolvable,
PermissionResolvable,
SlashCommandBuilder,
SlashCommandOptionsOnlyBuilder,
SlashCommandSubcommandsOnlyBuilder
} from 'discord.js';
export type Client = typeof ClientInstance;
type PrimitiveOrDictionary<P extends boolean, T> = P extends true ? T : { [K in keyof T]: T[K] | Record<string, T[K]> };
type NonFunctionProperties<T> = { [K in keyof T as T[K] extends CallableFunction ? never : K]: T[K] };
type RunFunctionOptions = { client: Client; interaction: ChatInputCommandInteraction };
type RunFunction = (options: RunFunctionOptions) => Promise<unknown>;
export type CommandConfig<P extends boolean = false> = PrimitiveOrDictionary<
P,
{
category: string;
tags?: string[];
guildOnly?: boolean;
dmOnly?: boolean;
supportServerOnly?: boolean;
requiredMemberPermissions?: PermissionResolvable[];
requiredBotPermissions?: PermissionResolvable[];
botAdminsOnly?: boolean;
disabled?: boolean;
}
>;
export type CommandData = {
data: SlashCommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder;
config: CommandConfig;
run: RunFunction;
};
export type ResolvedCommandData = CommandConfig<true> & NonFunctionProperties<SlashCommandBuilder> & { run: RunFunction };
export type EventData = {
name: string;
once?: boolean;
dontLoad?: boolean;
run: CallableFunction;
};
export type CustomMessageOptions = {
content: string;
title: string;
author: { name: string; iconURL?: string };
description: string;
fields: { name: string; value: string; inline?: boolean }[];
color: ColorResolvable;
thumbnail: string;
image: string;
footer: { text: string; iconURL?: string };
ephemeral: boolean;
};