bakit 1.0.0-beta.9 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/index.d.ts +304 -68
- package/dist/index.js +351 -1093
- package/package.json +16 -9
- package/dist/BakitClient-D9kRvFS3.d.ts +0 -224
- package/dist/command/index.d.ts +0 -3
- package/dist/command/index.js +0 -473
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# About us
|
|
2
|
+
|
|
3
|
+
Bakit is a framework that makes building Discord bots easier.
|
|
4
|
+
It's built on top of [discord.js](https://discord.js.org) and helps you handle the core system for your bot.
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
<a href="https://npmjs.com/package/bakit"><img src="https://img.shields.io/npm/v/bakit?logo=npm" alt="npm" /></a>
|
|
8
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/louiszn/bakit" alt="License" /></a>
|
|
9
|
+
<a href="https://discord.gg/pGnKbMfXke"><img src="https://img.shields.io/discord/1353321517437681724?logo=discord&logoColor=white" alt="Discord" /></a>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
> [!CAUTION]
|
|
13
|
+
> This package is currently being rewritten. Many features from beta v1 have not yet been migrated.
|
|
14
|
+
> It is not production-ready, and use in production environments is strongly discouraged.
|
|
15
|
+
|
|
16
|
+
## Why Bakit?
|
|
17
|
+
|
|
18
|
+
- 🧩 **Unified Command System** - write once for both slash and prefix command.
|
|
19
|
+
- 🚀 **Clean API interfaces** - well-structured commands and events.
|
|
20
|
+
- ⚡ **Lightweight** - minimal overhead, only what you need.
|
|
21
|
+
- ✨ **TypeScript + ESM first** - modern JavaScript tooling out of the box.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Official documentation is now at https://bakit.louiszn.xyz.
|
|
26
|
+
|
|
27
|
+
# Contributing
|
|
28
|
+
|
|
29
|
+
Contributions are always welcome! But before doing that, make sure you have already checked existing issues and pull requests before making a new one.
|
|
30
|
+
|
|
31
|
+
# Support
|
|
32
|
+
|
|
33
|
+
If you like Bakit and want to support its development, you can buy me a coffee:
|
|
34
|
+
|
|
35
|
+
[](https://ko-fi.com/louiszn)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,96 +1,332 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import EventEmitter from 'node:events';
|
|
6
|
-
import { SetOptional } from 'type-fest';
|
|
1
|
+
import * as discord_js from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, ClientOptions, ChatInputCommandInteraction, CacheType, Message, User, MessageCreateOptions, InteractionReplyOptions, Awaitable, Collection, ClientEvents, Events, Client } from 'discord.js';
|
|
3
|
+
import z$1, { z } from 'zod';
|
|
4
|
+
import { inspect } from 'node:util';
|
|
7
5
|
|
|
8
|
-
declare
|
|
6
|
+
declare const ProjectConfigSchema: z.ZodObject<{
|
|
7
|
+
intents: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodBigInt, z.ZodArray<z.ZodEnum<typeof GatewayIntentBits>>]>>;
|
|
8
|
+
clientOptions: z.ZodOptional<z.ZodCustom<Omit<ClientOptions, "intents">, Omit<ClientOptions, "intents">>>;
|
|
9
|
+
entryDir: z.ZodDefault<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
type ProjectConfigInput = z.input<typeof ProjectConfigSchema>;
|
|
12
|
+
type ProjectConfig = z.output<typeof ProjectConfigSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* Define config object for your project. This is just a cleaner way to define config.
|
|
15
|
+
* @param config The partial version of project config.
|
|
16
|
+
* @returns The same config you provided earlier.
|
|
17
|
+
*/
|
|
18
|
+
declare function defineConfig(config: ProjectConfigInput): ProjectConfigInput;
|
|
19
|
+
/**
|
|
20
|
+
* Load the config file and save them for later usage.
|
|
21
|
+
* @param cwd The location of the config file, uses root by default.
|
|
22
|
+
* @returns The complete config with default values from the validation.
|
|
23
|
+
*/
|
|
24
|
+
declare function loadConfig(cwd?: string): Promise<ProjectConfig>;
|
|
25
|
+
/**
|
|
26
|
+
* Get the loaded config of the project.
|
|
27
|
+
* @returns The project config.
|
|
28
|
+
*/
|
|
29
|
+
declare function getConfig(): ProjectConfig;
|
|
9
30
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static storage: AsyncLocalStorage<States>;
|
|
14
|
-
private static getState;
|
|
15
|
-
static run<R>(fn: () => R, store?: {}): R;
|
|
16
|
-
static wrap<R>(fn: () => R): () => R;
|
|
17
|
-
static use<T extends object>(defaultValue?: unknown): (target: T, key: keyof T) => void;
|
|
31
|
+
declare class Context {
|
|
32
|
+
canceled: boolean;
|
|
33
|
+
cancel(): void;
|
|
18
34
|
}
|
|
19
35
|
|
|
20
|
-
type
|
|
21
|
-
type
|
|
22
|
-
type
|
|
23
|
-
|
|
24
|
-
|
|
36
|
+
type ChatInputContextSendOptions = string | InteractionReplyOptions;
|
|
37
|
+
type MessageContextSendOptions = string | MessageCreateOptions;
|
|
38
|
+
type ContextSendOptions = ChatInputContextSendOptions | MessageContextSendOptions;
|
|
39
|
+
declare abstract class BaseCommandContext<Cached extends boolean, InGuild extends boolean> extends Context {
|
|
40
|
+
source: ChatInputCommandInteraction<Cached extends true ? "cached" : CacheType> | Message<InGuild>;
|
|
41
|
+
constructor(source: ChatInputCommandInteraction<Cached extends true ? "cached" : CacheType> | Message<InGuild>);
|
|
42
|
+
get client(): BakitClient<true>;
|
|
43
|
+
get channel(): discord_js.CacheTypeReducer<Cached extends true ? "cached" : CacheType, discord_js.GuildTextBasedChannel | null, discord_js.GuildTextBasedChannel | null, discord_js.GuildTextBasedChannel | null, discord_js.TextBasedChannel | null> | discord_js.If<InGuild, discord_js.GuildTextBasedChannel, discord_js.TextBasedChannel>;
|
|
44
|
+
get channelId(): string;
|
|
45
|
+
get guild(): discord_js.CacheTypeReducer<Cached extends true ? "cached" : CacheType, discord_js.Guild, null, discord_js.Guild | null, discord_js.Guild | null> | discord_js.If<InGuild, discord_js.Guild, null>;
|
|
46
|
+
get guildId(): discord_js.CacheTypeReducer<Cached extends true ? "cached" : CacheType, string, string, string, string | null> | discord_js.If<InGuild, string, null>;
|
|
47
|
+
get member(): discord_js.GuildMember | discord_js.CacheTypeReducer<Cached extends true ? "cached" : CacheType, discord_js.GuildMember, discord_js.APIInteractionGuildMember, discord_js.GuildMember | discord_js.APIInteractionGuildMember, discord_js.GuildMember | discord_js.APIInteractionGuildMember | null> | null;
|
|
48
|
+
inGuild(): this is CommandContext<Cached, true>;
|
|
49
|
+
inCachedGuild(): this is CommandContext<true, true>;
|
|
50
|
+
get user(): User;
|
|
51
|
+
isChatInput(): this is ChatInputContext;
|
|
52
|
+
isMessage(): this is MessageContext;
|
|
53
|
+
abstract send(options: ContextSendOptions): Promise<Message<InGuild>>;
|
|
25
54
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
declare class ChatInputContext<Cached extends boolean = boolean, InGuild extends boolean = boolean> extends BaseCommandContext<Cached, InGuild> {
|
|
56
|
+
source: ChatInputCommandInteraction<Cached extends true ? "cached" : CacheType>;
|
|
57
|
+
send(options: ContextSendOptions): Promise<Message<InGuild>>;
|
|
58
|
+
}
|
|
59
|
+
declare class MessageContext<Cached extends boolean = boolean, InGuild extends boolean = boolean> extends BaseCommandContext<Cached, InGuild> {
|
|
60
|
+
source: Message<InGuild>;
|
|
61
|
+
send(options: string | MessageCreateOptions): Promise<Message<InGuild>>;
|
|
62
|
+
}
|
|
63
|
+
type CommandContext<Cached extends boolean = boolean, InGuild extends boolean = boolean> = ChatInputContext<Cached, InGuild> | MessageContext<Cached, InGuild>;
|
|
64
|
+
|
|
65
|
+
declare enum HookState {
|
|
66
|
+
Pre = "PRE",
|
|
67
|
+
Main = "MAIN",
|
|
68
|
+
Post = "POST",
|
|
69
|
+
Error = "ERROR"
|
|
70
|
+
}
|
|
71
|
+
declare enum HookOrder {
|
|
72
|
+
First = 0,
|
|
73
|
+
Last = 1
|
|
30
74
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
75
|
+
type MainHookCallback<C extends Context, Args extends unknown[]> = (context: C, ...args: Args) => Awaitable<void>;
|
|
76
|
+
type ErrorHookCallback<C extends Context, Args extends unknown[]> = (context: C, error: unknown, ...args: Args) => Awaitable<void>;
|
|
77
|
+
declare class LifecycleManager<C extends Context, Args extends unknown[]> {
|
|
78
|
+
id: string;
|
|
79
|
+
private readonly hooks;
|
|
80
|
+
constructor(id: string);
|
|
81
|
+
getName(name: string): string;
|
|
82
|
+
setHook(name: string, state: HookState.Post, callback: MainHookCallback<C, Args>, order?: HookOrder): this;
|
|
83
|
+
setHook(name: string, state: HookState.Main, callback: MainHookCallback<C, Args>, order?: HookOrder): this;
|
|
84
|
+
setHook(name: string, state: HookState.Pre, callback: MainHookCallback<C, Args>, order?: HookOrder): this;
|
|
85
|
+
setHook(name: string, state: HookState.Error, callback: ErrorHookCallback<C, Args>, order?: HookOrder): this;
|
|
86
|
+
main(callback: MainHookCallback<C, Args>): this;
|
|
87
|
+
pre(callback: MainHookCallback<C, Args>): this;
|
|
88
|
+
post(callback: MainHookCallback<C, Args>): this;
|
|
89
|
+
error(callback: ErrorHookCallback<C, Args>): this;
|
|
90
|
+
execute(context: C, ...args: Args): Promise<void>;
|
|
34
91
|
}
|
|
35
92
|
|
|
36
|
-
declare
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
93
|
+
declare enum ParamUserType {
|
|
94
|
+
Bot = "bot",
|
|
95
|
+
Normal = "normal",
|
|
96
|
+
Any = "any"
|
|
40
97
|
}
|
|
41
|
-
declare
|
|
42
|
-
|
|
98
|
+
declare const BaseParamSchema: z.ZodObject<{
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
description: z.ZodOptional<z.ZodString>;
|
|
101
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
declare const StringParamSchema: z.ZodObject<{
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
106
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
107
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
declare const NumberParamSchema: z.ZodObject<{
|
|
111
|
+
name: z.ZodString;
|
|
112
|
+
description: z.ZodOptional<z.ZodString>;
|
|
113
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
114
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
type BaseParamOptions = z.input<typeof BaseParamSchema>;
|
|
118
|
+
type StringOptions = z.input<typeof StringParamSchema>;
|
|
119
|
+
type NumberOptions = z.input<typeof NumberParamSchema>;
|
|
43
120
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
private static client;
|
|
49
|
-
static constructors: Set<ConstructorLike>;
|
|
50
|
-
static instances: WeakMap<ConstructorLike, object>;
|
|
51
|
-
static executors: WeakMap<object, (...args: unknown[]) => Promise<void>>;
|
|
121
|
+
declare abstract class BaseParam<Options extends BaseParamOptions, OutputType, Required extends boolean = true> {
|
|
122
|
+
options: Options & {
|
|
123
|
+
required: Required;
|
|
124
|
+
};
|
|
52
125
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
126
|
+
* **Internal Phantom Type**
|
|
127
|
+
*
|
|
128
|
+
* Used strictly for TypeScript type inference to determine the runtime value
|
|
129
|
+
* of this parameter. This property does not exist at runtime.
|
|
130
|
+
*
|
|
131
|
+
* @internal
|
|
56
132
|
*/
|
|
57
|
-
|
|
133
|
+
readonly _type: Required extends true ? OutputType : OutputType | null;
|
|
134
|
+
constructor(options: Options);
|
|
135
|
+
protected setOption(key: keyof Options, value: any): this;
|
|
136
|
+
name(value: string): this;
|
|
137
|
+
description(value: string): this;
|
|
138
|
+
required<V extends boolean>(value: V): BaseParam<Options, OutputType, V>;
|
|
58
139
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @param constructor The listener class you want to remove.
|
|
61
|
-
* @returns `boolean`, returns `true` if the listener is removed successfully.
|
|
140
|
+
* Helper to normalize string inputs into an options object.
|
|
62
141
|
*/
|
|
63
|
-
static
|
|
142
|
+
protected static getOptions<Options>(options: Options | string): Options;
|
|
143
|
+
}
|
|
144
|
+
declare class StringParam<Required extends boolean = true> extends BaseParam<StringOptions, string, Required> {
|
|
145
|
+
constructor(options: string | StringOptions);
|
|
146
|
+
required<V extends boolean>(value: V): StringParam<V>;
|
|
64
147
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
148
|
+
* Sets the minimum allowed length for this string.
|
|
149
|
+
* Pass `null` to remove this constraint.
|
|
67
150
|
*/
|
|
68
|
-
|
|
151
|
+
min(length: number | null): this;
|
|
69
152
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
153
|
+
* Sets the maximum allowed length for this string.
|
|
154
|
+
* Pass `null` to remove this constraint.
|
|
72
155
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
156
|
+
max(length: number | null): this;
|
|
157
|
+
}
|
|
158
|
+
declare class NumberParam<Required extends boolean = true> extends BaseParam<NumberOptions, number, Required> {
|
|
159
|
+
constructor(options: string | NumberOptions);
|
|
160
|
+
required<V extends boolean>(value: V): NumberParam<V>;
|
|
161
|
+
/**
|
|
162
|
+
* Sets the minimum allowed value for this number.
|
|
163
|
+
* Pass `null` to remove this constraint.
|
|
164
|
+
*/
|
|
165
|
+
min(value: number | null): this;
|
|
75
166
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @param parallel load all matched results in parallel, enabled by default.
|
|
79
|
-
* @returns All loaded listener constructors.
|
|
167
|
+
* Sets the maximum allowed value for this number.
|
|
168
|
+
* Pass `null` to remove this constraint.
|
|
80
169
|
*/
|
|
81
|
-
|
|
170
|
+
max(value: number | null): this;
|
|
82
171
|
}
|
|
172
|
+
type AnyParam<Required extends boolean = true> = BaseParam<any, any, Required>;
|
|
173
|
+
/**
|
|
174
|
+
* Helper type to extract the runtime value of a Param instance.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* const p = new StringParam("name").required(false);
|
|
178
|
+
* type T = InferParamValue<typeof p>; // string | null
|
|
179
|
+
*/
|
|
180
|
+
type InferParamValue<P extends AnyParam<any>> = P["_type"];
|
|
181
|
+
type InferParamTuple<T extends readonly BaseParam<any, any, any>[]> = {
|
|
182
|
+
[K in keyof T]: T[K] extends AnyParam<any> ? InferParamValue<T[K]> : never;
|
|
183
|
+
};
|
|
83
184
|
|
|
185
|
+
declare const CommandOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
186
|
+
name: z.ZodString;
|
|
187
|
+
description: z.ZodOptional<z.ZodString>;
|
|
188
|
+
params: z.ZodDefault<z.ZodArray<z.ZodCustom<BaseParam<{
|
|
189
|
+
name: string;
|
|
190
|
+
description?: string | undefined;
|
|
191
|
+
required?: boolean | undefined;
|
|
192
|
+
}, unknown, boolean>, BaseParam<{
|
|
193
|
+
name: string;
|
|
194
|
+
description?: string | undefined;
|
|
195
|
+
required?: boolean | undefined;
|
|
196
|
+
}, unknown, boolean>>>>;
|
|
197
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
198
|
+
description: string;
|
|
199
|
+
name: string;
|
|
200
|
+
params: BaseParam<{
|
|
201
|
+
name: string;
|
|
202
|
+
description?: string | undefined;
|
|
203
|
+
required?: boolean | undefined;
|
|
204
|
+
}, unknown, boolean>[];
|
|
205
|
+
}, {
|
|
206
|
+
name: string;
|
|
207
|
+
params: BaseParam<{
|
|
208
|
+
name: string;
|
|
209
|
+
description?: string | undefined;
|
|
210
|
+
required?: boolean | undefined;
|
|
211
|
+
}, unknown, boolean>[];
|
|
212
|
+
description?: string | undefined;
|
|
213
|
+
}>>;
|
|
214
|
+
type CommandOptionsInput = z.input<typeof CommandOptionsSchema>;
|
|
215
|
+
type CommandOptions = z.output<typeof CommandOptionsSchema>;
|
|
84
216
|
/**
|
|
85
|
-
*
|
|
86
|
-
* Most of the structure is from Base, but some might be not
|
|
217
|
+
* The command entry, used for registering command.
|
|
87
218
|
*/
|
|
219
|
+
declare class Command<ParamsList extends readonly AnyParam<any>[] = []> extends LifecycleManager<CommandContext, [
|
|
220
|
+
...args: InferParamTuple<ParamsList>
|
|
221
|
+
]> {
|
|
222
|
+
options: CommandOptions;
|
|
223
|
+
constructor(options: (Omit<CommandOptionsInput, "params"> & {
|
|
224
|
+
params?: ParamsList;
|
|
225
|
+
}) | string);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Define command entry, usually for modules.
|
|
229
|
+
* @param options The command options.
|
|
230
|
+
* @returns The entry of the command to deploy or register hooks.
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* import { defineCommand } from "bakit";
|
|
234
|
+
*
|
|
235
|
+
* const command = defineCommand({
|
|
236
|
+
* name: "ping",
|
|
237
|
+
* description: "Displays bot's latency.",
|
|
238
|
+
* });
|
|
239
|
+
*
|
|
240
|
+
* command.main(async (context) => {
|
|
241
|
+
* await context.send(`Pong! ${context.client.ws.ping}ms!`);
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* export default command;
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
declare function defineCommand<const ParamsList extends readonly AnyParam<any>[] = []>(options: (Omit<CommandOptionsInput, "params"> & {
|
|
248
|
+
params?: ParamsList;
|
|
249
|
+
}) | string): Command<ParamsList>;
|
|
250
|
+
|
|
251
|
+
declare class BaseClientManager {
|
|
252
|
+
client: BakitClient;
|
|
253
|
+
constructor(client: BakitClient);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare class CommandManager extends BaseClientManager {
|
|
257
|
+
commands: Collection<string, Command<[]>>;
|
|
258
|
+
loadModules(): Promise<Command[]>;
|
|
259
|
+
add(command: Command): void;
|
|
260
|
+
remove(target: string | Command): Command | undefined;
|
|
261
|
+
get(name: string): Command<[]> | undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare const ListenerOptionsSchema: z$1.ZodObject<{
|
|
265
|
+
name: z$1.ZodEnum<typeof Events>;
|
|
266
|
+
once: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
267
|
+
}, z$1.z.core.$strip>;
|
|
268
|
+
type ListenerOptions<K extends EventKey = EventKey> = Omit<z$1.input<typeof ListenerOptionsSchema>, "name"> & {
|
|
269
|
+
name: K;
|
|
270
|
+
};
|
|
271
|
+
type EventKey = keyof ClientEvents;
|
|
272
|
+
declare class Listener<K extends EventKey = EventKey> extends LifecycleManager<Context, [...args: ClientEvents[K]]> {
|
|
273
|
+
options: ListenerOptions<K>;
|
|
274
|
+
constructor(options: K | ListenerOptions<K>);
|
|
275
|
+
}
|
|
276
|
+
declare function defineListener<const K extends EventKey = EventKey>(options: K | ListenerOptions<K>): Listener<K>;
|
|
88
277
|
|
|
278
|
+
declare class ListenerManager extends BaseClientManager {
|
|
279
|
+
listeners: Listener[];
|
|
280
|
+
private executors;
|
|
281
|
+
loadModules(): Promise<Listener[]>;
|
|
282
|
+
add(listener: Listener): void;
|
|
283
|
+
remove(target: string | Listener): Listener[];
|
|
284
|
+
}
|
|
89
285
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
286
|
+
type GetPrefixFunction = (message: Message) => Awaitable<string[] | string>;
|
|
287
|
+
interface BakitClientEvents extends ClientEvents {
|
|
288
|
+
ready: [BakitClient<true>];
|
|
289
|
+
clientReady: [BakitClient<true>];
|
|
94
290
|
}
|
|
291
|
+
declare class BakitClient<Ready extends boolean = boolean> extends Client<Ready> {
|
|
292
|
+
managers: {
|
|
293
|
+
commands: CommandManager;
|
|
294
|
+
listeners: ListenerManager;
|
|
295
|
+
};
|
|
296
|
+
constructor(options: ClientOptions);
|
|
297
|
+
start(token?: string): Promise<string>;
|
|
298
|
+
/**
|
|
299
|
+
* Check if the client is connected to gateway successfully and finished initialization.
|
|
300
|
+
*/
|
|
301
|
+
isReady(): this is BakitClient<true>;
|
|
302
|
+
on<K extends keyof BakitClientEvents>(event: K, listener: (...args: BakitClientEvents[K]) => void): this;
|
|
303
|
+
once<K extends keyof BakitClientEvents>(event: K, listener: (...args: BakitClientEvents[K]) => void): this;
|
|
304
|
+
off<K extends keyof BakitClientEvents>(event: K, listener: (...args: BakitClientEvents[K]) => void): this;
|
|
305
|
+
removeAllListeners(event?: keyof BakitClientEvents): this;
|
|
306
|
+
removeListener<K extends keyof BakitClientEvents>(event: K, listener: (...args: BakitClientEvents[K]) => void): this;
|
|
307
|
+
emit<K extends keyof BakitClientEvents>(event: K, ...args: BakitClientEvents[K]): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Override BakitClient output when using logger for security concern.
|
|
310
|
+
* @returns `BakitClient {}`
|
|
311
|
+
*/
|
|
312
|
+
[inspect.custom](): string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare const Params: {
|
|
316
|
+
readonly string: <Required extends boolean = true>(options: string | {
|
|
317
|
+
name: string;
|
|
318
|
+
description?: string | undefined;
|
|
319
|
+
required?: boolean | undefined;
|
|
320
|
+
maxLength?: number | undefined;
|
|
321
|
+
minLength?: number | undefined;
|
|
322
|
+
}) => StringParam<Required>;
|
|
323
|
+
readonly number: <Required extends boolean = true>(options: string | {
|
|
324
|
+
name: string;
|
|
325
|
+
description?: string | undefined;
|
|
326
|
+
required?: boolean | undefined;
|
|
327
|
+
maxValue?: number | undefined;
|
|
328
|
+
minValue?: number | undefined;
|
|
329
|
+
}) => NumberParam<Required>;
|
|
330
|
+
};
|
|
95
331
|
|
|
96
|
-
export { BakitClient, type
|
|
332
|
+
export { type AnyParam, BakitClient, type BakitClientEvents, BaseCommandContext, BaseParam, type BaseParamOptions, BaseParamSchema, ChatInputContext, type ChatInputContextSendOptions, Command, type CommandContext, CommandManager, type CommandOptions, type CommandOptionsInput, CommandOptionsSchema, type ContextSendOptions, type GetPrefixFunction, type InferParamTuple, type InferParamValue, Listener, ListenerManager, type ListenerOptions, ListenerOptionsSchema, MessageContext, type MessageContextSendOptions, type NumberOptions, NumberParam, NumberParamSchema, ParamUserType, Params, type ProjectConfig, type ProjectConfigInput, ProjectConfigSchema, type StringOptions, StringParam, StringParamSchema, defineCommand, defineConfig, defineListener, getConfig, loadConfig };
|