forked from BurakYs/bot-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.ts
50 lines (42 loc) · 1.75 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
import type { ChatInputCommandInteraction, ColorResolvable, PermissionResolvable, SlashCommandBuilder, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder } from 'discord.js';
import type ClientInstance from '@/loaders/client';
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]; };
export type Client = typeof ClientInstance;
export type RunFunctionOptions = { client: Client, interaction: ChatInputCommandInteraction }
export 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 | string;
thumbnail: string;
image: string;
footer: { text: string; iconURL?: string };
ephemeral: boolean;
}