bakit 3.0.1 → 3.2.0

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/dist/index.d.cts CHANGED
@@ -2,112 +2,493 @@ import { Cluster, ClusterEvents, ClusterOptions, Shard, ShardEvents, ShardOption
2
2
  import { BaseRESTEvents, DEFAULT_REST_OPTIONS, DiscordHTTPError, DiscordHTTPErrorRequest, DiscordHTTPFlattenedError, DiscordHTTPValidationError, REST, RESTAdapter, RESTAdapterEvents, RESTEndpoint, RESTEvents, RESTLike, RESTLike as RESTLike$1, RESTMethod, RESTOptions, RESTProxyOptions, RESTRequestFn, RESTRequestOptions, createREST, createRESTAdapter } from "@bakit/rest";
3
3
  import { RPCHandler, Service, ServiceClientRuntime, ServiceDriver, ServiceOptions, ServiceProcess, ServiceProcessEvents, ServiceServerRuntime, ServiceState, TransportClient, TransportClientEvents, TransportServer, TransportServerEvents, createService, createTransportClient, createTransportServer } from "@bakit/service";
4
4
  import * as _bakit_utils0 from "@bakit/utils";
5
- import { AbstractConstructor, Awaitable, Constructor, FunctionLike, Promisify, PromisifyValue, RejectFn, ResolveFn, capitalize, instanceToObject, isCommonJS, isESM, isPlainObject, isPromiseLike, promisify, sleep } from "@bakit/utils";
5
+ import { AbstractConstructor, Awaitable, Awaitable as Awaitable$1, Constructor, FunctionLike, Promisify, PromisifyValue, RejectFn, ResolveFn, capitalize, instanceToObject, isCommonJS, isESM, isPlainObject, isPromiseLike, promisify, sleep } from "@bakit/utils";
6
6
  import EventEmitter from "node:events";
7
- import { Collection } from "@discordjs/collection";
8
7
  import * as discord_api_types_v100 from "discord-api-types/v10";
9
- import { APIAllowedMentions, APIChannel, APIChannelBase, APIEmbed, APIGuild, APIGuildVoiceChannel, APIMessage, APIMessageReference, APITextBasedChannel, APIUser, ChannelType, GatewayChannelCreateDispatchData, GatewayChannelUpdateDispatchData, GatewayDispatchPayload, GatewayGuildCreateDispatchData, GatewayGuildUpdateDispatchData, GatewayIntentBits, GatewayIntentBits as Intent, GatewayMessageCreateDispatchData, GatewayMessageUpdateDispatchData, GatewayReadyDispatchData, GatewayReceivePayload } from "discord-api-types/v10";
8
+ import { APIAllowedMentions, APIChannel, APIChannelBase, APIDMChannel, APIEmbed, APIGuild, APIGuildCategoryChannel, APIGuildForumChannel, APIGuildForumTag, APIGuildStageVoiceChannel, APIGuildTextChannel, APIGuildVoiceChannel, APIMessage, APIMessageReference, APINewsChannel, APIThreadChannel, APIUser, ChannelType, ForumLayoutType, GatewayChannelCreateDispatchData, GatewayChannelUpdateDispatchData, GatewayDispatchPayload, GatewayGuildCreateDispatchData, GatewayGuildUpdateDispatchData, GatewayIntentBits, GatewayIntentBits as Intent, GatewayMessageCreateDispatchData, GatewayMessageUpdateDispatchData, GatewayReadyDispatchData, GatewayReceivePayload, GatewayTypingStartDispatchData, GuildTextChannelType, RESTPostAPIGuildChannelJSONBody, SortOrderType, ThreadAutoArchiveDuration } from "discord-api-types/v10";
9
+ import * as _discordjs_collection0 from "@discordjs/collection";
10
+ import { Collection } from "@discordjs/collection";
11
+ import * as discord_api_types_globals0 from "discord-api-types/globals";
12
+ import { Snowflake } from "discord-api-types/globals";
10
13
 
11
14
  //#region src/lib/structures/BaseStructure.d.ts
12
15
  declare class BaseStructure {
13
- client: Client;
14
- constructor(client: Client);
16
+ client: Client<true>;
17
+ constructor(client: Client<true>);
15
18
  toJSON(): {};
16
19
  }
17
20
  //#endregion
18
- //#region src/lib/structures/channel/GuildTextChannel.d.ts
19
- declare const GuildTextChannel_base: (abstract new (client: Client, data: APITextBasedChannel<ChannelType.GuildText>) => BaseChannel<APITextBasedChannel<ChannelType.GuildText>>) & (abstract new (...args: any[]) => {
21
+ //#region src/lib/structures/channel/GuildCategory.d.ts
22
+ declare const GuildCategory_base: {
23
+ new (client: Client, data: APIGuildCategoryChannel): BaseChannel<APIGuildCategoryChannel, discord_api_types_v100.ChannelType.GuildCategory>;
24
+ } & (abstract new (...args: any[]) => {
25
+ get parentId(): string | undefined;
26
+ get parent(): /*elided*/any | undefined;
20
27
  get guildId(): string;
21
28
  get guild(): Guild;
22
29
  data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
30
+ get partial(): boolean;
23
31
  get id(): string;
24
- get type(): ChannelType;
32
+ get type(): discord_api_types_v100.GuildChannelType;
33
+ toString(): string;
34
+ toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
35
+ isTextBased(): this is TextBasedChannel;
36
+ isVoiceBased(): this is VoiceBasedChannel;
37
+ isDM(): this is DMChannel;
38
+ isThread(): this is ThreadBasedChannel;
39
+ isPublicThread(): this is ThreadBasedChannel;
40
+ isPrivateThread(): this is ThreadBasedChannel;
41
+ isAnnouncementThread(): this is ThreadBasedChannel;
42
+ isCategory(): this is GuildCategory;
43
+ inGuild(): this is GuildChannel;
44
+ fetch(): Promise< /*elided*/any>;
45
+ _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
46
+ client: Client<true>;
47
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>>;
48
+ declare class GuildCategory extends GuildCategory_base {
49
+ constructor(client: Client, data: APIGuildCategoryChannel);
50
+ get children(): _discordjs_collection0.Collection<string, Channel>;
51
+ }
52
+ //#endregion
53
+ //#region src/lib/managers/client/ClientChannelManager.d.ts
54
+ interface MessageCreateOptions {
55
+ content?: string;
56
+ tts?: boolean;
57
+ embeds?: APIEmbed[];
58
+ allowedMentions?: APIAllowedMentions;
59
+ messageReference?: APIMessageReference;
60
+ flags?: number;
61
+ }
62
+ type MessageReplyOptions = Omit<MessageCreateOptions, "messageReference">;
63
+ type MessageEditOptions = Omit<MessageCreateOptions, "messageReference">;
64
+ declare class ClientChannelManager {
65
+ readonly client: Client;
66
+ constructor(client: Client);
67
+ fetch<C extends Channel>(id: Snowflake, force?: boolean): Promise<C | undefined>;
68
+ delete(id: Snowflake, force?: boolean): Promise<Channel | undefined>;
69
+ create(guildId: Snowflake, payload: RESTPostAPIGuildChannelJSONBody): Promise<BaseChannel<discord_api_types_v100.APIGroupDMChannel | discord_api_types_v100.APIGuildCategoryChannel | discord_api_types_v100.APIGuildMediaChannel | discord_api_types_v100.APIChannelBase<ChannelType> | (discord_api_types_v100.APIGuildCategoryChannel & {
70
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
71
+ guild_id: Snowflake;
72
+ }) | (discord_api_types_v100.APIGuildMediaChannel & {
73
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
74
+ guild_id: Snowflake;
75
+ }), ChannelType>>;
76
+ crosspost(channelId: Snowflake, messageId: Snowflake): Promise<Message<true>>;
77
+ createMessage(channelId: Snowflake, options: MessageCreateOptions | string): Promise<Message<boolean>>;
78
+ editMessage(channelId: Snowflake, messageId: Snowflake, options: MessageEditOptions | string): Promise<Message<boolean>>;
79
+ deleteMessage(channelId: Snowflake, messageId: Snowflake, force?: boolean): Promise<Message<boolean> | undefined>;
80
+ replyMessage(channelId: Snowflake, messageId: Snowflake, options: MessageReplyOptions | string): Promise<Message<boolean>>;
81
+ resolve(data: BaseChannelPayload): BaseChannel<discord_api_types_v100.APIGroupDMChannel | discord_api_types_v100.APIGuildCategoryChannel | discord_api_types_v100.APIGuildMediaChannel | discord_api_types_v100.APIChannelBase<ChannelType> | (discord_api_types_v100.APIGuildCategoryChannel & {
82
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
83
+ guild_id: Snowflake;
84
+ }) | (discord_api_types_v100.APIGuildMediaChannel & {
85
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
86
+ guild_id: Snowflake;
87
+ }), ChannelType>;
88
+ static create(client: Client, data: BaseChannelPayload): BaseChannel<discord_api_types_v100.APIGroupDMChannel | discord_api_types_v100.APIGuildCategoryChannel | discord_api_types_v100.APIGuildMediaChannel | discord_api_types_v100.APIChannelBase<ChannelType> | (discord_api_types_v100.APIGuildCategoryChannel & {
89
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
90
+ guild_id: Snowflake;
91
+ }) | (discord_api_types_v100.APIGuildMediaChannel & {
92
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
93
+ guild_id: Snowflake;
94
+ }), ChannelType>;
95
+ joinThread(threadId: Snowflake): Promise<unknown>;
96
+ static createMessagePayload(options: MessageCreateOptions): {
97
+ content: string | undefined;
98
+ tts: boolean | undefined;
99
+ embeds: APIEmbed[] | undefined;
100
+ allowed_mentions: APIAllowedMentions | undefined;
101
+ message_reference: APIMessageReference | undefined;
102
+ flags: number | undefined;
103
+ };
104
+ }
105
+ //#endregion
106
+ //#region src/lib/structures/channel/ThreadChannel.d.ts
107
+ interface PublicThread extends ThreadChannel {
108
+ readonly type: ChannelType.PublicThread;
109
+ }
110
+ interface PrivateThread extends ThreadChannel {
111
+ readonly type: ChannelType.PrivateThread;
112
+ }
113
+ interface AnnouncementThread extends ThreadChannel {
114
+ readonly type: ChannelType.AnnouncementThread;
115
+ }
116
+ type ThreadBasedChannel = PublicThread | PrivateThread | AnnouncementThread;
117
+ declare const ThreadChannel_base: {
118
+ new (client: Client, data: APIThreadChannel<discord_api_types_v100.ThreadChannelType>): BaseChannel<APIThreadChannel<discord_api_types_v100.ThreadChannelType>, discord_api_types_v100.ThreadChannelType>;
119
+ } & (abstract new (...args: any[]) => {
120
+ get parentId(): string | undefined;
121
+ get parent(): /*elided*/any | undefined;
122
+ get guildId(): string;
123
+ get guild(): Guild;
124
+ data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
125
+ get partial(): boolean;
126
+ get id(): string;
127
+ get type(): discord_api_types_v100.GuildChannelType;
25
128
  toString(): string;
26
129
  toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
27
130
  isTextBased(): this is TextBasedChannel;
28
131
  isVoiceBased(): this is VoiceBasedChannel;
132
+ isDM(): this is DMChannel;
133
+ isThread(): this is ThreadBasedChannel;
134
+ isPublicThread(): this is ThreadBasedChannel;
135
+ isPrivateThread(): this is ThreadBasedChannel;
136
+ isAnnouncementThread(): this is ThreadBasedChannel;
137
+ isCategory(): this is GuildCategory;
29
138
  inGuild(): this is GuildChannel;
139
+ fetch(): Promise< /*elided*/any>;
30
140
  _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
31
- client: Client;
32
- }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>> & (abstract new (...args: any[]) => {
33
- send(options: MessageCreateOptions): Promise<discord_api_types_v100.APIMessage>;
34
- data: APITextBasedChannel<ChannelType>;
141
+ client: Client<true>;
142
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>> & (abstract new (...args: any[]) => {
143
+ get lastMessageId(): string | undefined;
144
+ get rateLimitPerUser(): number | undefined;
145
+ send(options: MessageCreateOptions | string): Promise<Message<boolean>>;
146
+ data: discord_api_types_v100.APITextBasedChannel<ChannelType>;
147
+ get partial(): boolean;
35
148
  get id(): string;
36
149
  get type(): ChannelType;
37
150
  toString(): string;
38
- toJSON(): APITextBasedChannel<ChannelType>;
151
+ toJSON(): discord_api_types_v100.APITextBasedChannel<ChannelType>;
152
+ isTextBased(): this is TextBasedChannel;
153
+ isVoiceBased(): this is VoiceBasedChannel;
154
+ isDM(): this is DMChannel;
155
+ isThread(): this is ThreadBasedChannel;
156
+ isPublicThread(): this is ThreadBasedChannel;
157
+ isPrivateThread(): this is ThreadBasedChannel;
158
+ isAnnouncementThread(): this is ThreadBasedChannel;
159
+ isCategory(): this is GuildCategory;
160
+ inGuild(): this is GuildChannel;
161
+ fetch(): Promise< /*elided*/any>;
162
+ _patch(data: Partial<discord_api_types_v100.APITextBasedChannel<ChannelType>>): void;
163
+ client: Client<true>;
164
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<ChannelType>, ChannelType>>;
165
+ declare class ThreadChannel extends ThreadChannel_base {
166
+ get ownerId(): string | undefined;
167
+ get archived(): boolean;
168
+ get locked(): boolean;
169
+ get autoArchiveDuration(): discord_api_types_v100.ThreadAutoArchiveDuration | undefined;
170
+ get archiveTimestamp(): string | undefined;
171
+ get invitable(): boolean | undefined;
172
+ get memberCount(): number | undefined;
173
+ get messageCount(): number | undefined;
174
+ get totalMessageSent(): number | undefined;
175
+ }
176
+ //#endregion
177
+ //#region src/lib/structures/channel/DMChannel.d.ts
178
+ declare const DMChannel_base: {
179
+ new (client: Client, data: APIDMChannel): BaseChannel<APIDMChannel, discord_api_types_v100.ChannelType.DM>;
180
+ } & (abstract new (...args: any[]) => {
181
+ get lastMessageId(): string | undefined;
182
+ get rateLimitPerUser(): number | undefined;
183
+ send(options: MessageCreateOptions | string): Promise<Message<boolean>>;
184
+ data: discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
185
+ get partial(): boolean;
186
+ get id(): string;
187
+ get type(): discord_api_types_v100.ChannelType;
188
+ toString(): string;
189
+ toJSON(): discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
190
+ isTextBased(): this is TextBasedChannel;
191
+ isVoiceBased(): this is VoiceBasedChannel;
192
+ isDM(): this is DMChannel;
193
+ isThread(): this is ThreadBasedChannel;
194
+ isPublicThread(): this is ThreadBasedChannel;
195
+ isPrivateThread(): this is ThreadBasedChannel;
196
+ isAnnouncementThread(): this is ThreadBasedChannel;
197
+ isCategory(): this is GuildCategory;
198
+ inGuild(): this is GuildChannel;
199
+ fetch(): Promise< /*elided*/any>;
200
+ _patch(data: Partial<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>>): void;
201
+ client: Client<true>;
202
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>, discord_api_types_v100.ChannelType>>;
203
+ declare class DMChannel extends DMChannel_base {
204
+ #private;
205
+ constructor(client: Client, data: APIDMChannel);
206
+ get recipients(): Collection<string, User>;
207
+ get recipientId(): string;
208
+ get recipient(): User;
209
+ fetch(): Promise<this>;
210
+ send(options: MessageCreateOptions | string): Promise<Message<false>>;
211
+ fetchRecipients(force?: boolean): Promise<Collection<string, User> | undefined>;
212
+ _patch(data: Partial<APIDMChannel>): void;
213
+ }
214
+ //#endregion
215
+ //#region src/lib/structures/channel/GuildTextChannel.d.ts
216
+ declare const GuildTextChannel_base: {
217
+ new (client: Client, data: APIGuildTextChannel<GuildTextChannelType>): BaseChannel<APIGuildTextChannel<GuildTextChannelType>, GuildTextChannelType>;
218
+ } & (abstract new (...args: any[]) => {
219
+ get parentId(): string | undefined;
220
+ get parent(): /*elided*/any | undefined;
221
+ get guildId(): string;
222
+ get guild(): Guild;
223
+ data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
224
+ get partial(): boolean;
225
+ get id(): string;
226
+ get type(): discord_api_types_v100.GuildChannelType;
227
+ toString(): string;
228
+ toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
39
229
  isTextBased(): this is TextBasedChannel;
40
230
  isVoiceBased(): this is VoiceBasedChannel;
231
+ isDM(): this is DMChannel;
232
+ isThread(): this is ThreadBasedChannel;
233
+ isPublicThread(): this is ThreadBasedChannel;
234
+ isPrivateThread(): this is ThreadBasedChannel;
235
+ isAnnouncementThread(): this is ThreadBasedChannel;
236
+ isCategory(): this is GuildCategory;
41
237
  inGuild(): this is GuildChannel;
42
- _patch(data: Partial<APITextBasedChannel<ChannelType>>): void;
43
- client: Client;
44
- }) & _bakit_utils0.AbstractConstructor<BaseChannel<APITextBasedChannel<ChannelType>>>;
238
+ fetch(): Promise< /*elided*/any>;
239
+ _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
240
+ client: Client<true>;
241
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>> & (abstract new (...args: any[]) => {
242
+ get lastMessageId(): string | undefined;
243
+ get rateLimitPerUser(): number | undefined;
244
+ send(options: MessageCreateOptions | string): Promise<Message<boolean>>;
245
+ data: discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
246
+ get partial(): boolean;
247
+ get id(): string;
248
+ get type(): discord_api_types_v100.ChannelType;
249
+ toString(): string;
250
+ toJSON(): discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
251
+ isTextBased(): this is TextBasedChannel;
252
+ isVoiceBased(): this is VoiceBasedChannel;
253
+ isDM(): this is DMChannel;
254
+ isThread(): this is ThreadBasedChannel;
255
+ isPublicThread(): this is ThreadBasedChannel;
256
+ isPrivateThread(): this is ThreadBasedChannel;
257
+ isAnnouncementThread(): this is ThreadBasedChannel;
258
+ isCategory(): this is GuildCategory;
259
+ inGuild(): this is GuildChannel;
260
+ fetch(): Promise< /*elided*/any>;
261
+ _patch(data: Partial<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>>): void;
262
+ client: Client<true>;
263
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>, discord_api_types_v100.ChannelType>>;
45
264
  declare class GuildTextChannel extends GuildTextChannel_base {}
46
265
  //#endregion
47
266
  //#region src/lib/structures/channel/GuildVoiceChannel.d.ts
48
- declare const GuildVoiceChannel_base: (abstract new (client: Client, data: APIGuildVoiceChannel) => BaseChannel<APIGuildVoiceChannel>) & (abstract new (...args: any[]) => {
267
+ declare const GuildVoiceChannel_base: {
268
+ new (client: Client, data: APIGuildVoiceChannel): BaseChannel<APIGuildVoiceChannel, discord_api_types_v100.ChannelType.GuildVoice>;
269
+ } & (abstract new (...args: any[]) => {
270
+ get parentId(): string | undefined;
271
+ get parent(): /*elided*/any | undefined;
49
272
  get guildId(): string;
50
273
  get guild(): Guild;
51
274
  data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
275
+ get partial(): boolean;
52
276
  get id(): string;
53
- get type(): discord_api_types_v100.ChannelType;
277
+ get type(): discord_api_types_v100.GuildChannelType;
54
278
  toString(): string;
55
279
  toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
56
280
  isTextBased(): this is TextBasedChannel;
57
281
  isVoiceBased(): this is VoiceBasedChannel;
282
+ isDM(): this is DMChannel;
283
+ isThread(): this is ThreadBasedChannel;
284
+ isPublicThread(): this is ThreadBasedChannel;
285
+ isPrivateThread(): this is ThreadBasedChannel;
286
+ isAnnouncementThread(): this is ThreadBasedChannel;
287
+ isCategory(): this is GuildCategory;
58
288
  inGuild(): this is GuildChannel;
289
+ fetch(): Promise< /*elided*/any>;
59
290
  _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
60
- client: Client;
61
- }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>> & (abstract new (...args: any[]) => {
62
- send(options: MessageCreateOptions): Promise<discord_api_types_v100.APIMessage>;
291
+ client: Client<true>;
292
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>> & (abstract new (...args: any[]) => {
293
+ get lastMessageId(): string | undefined;
294
+ get rateLimitPerUser(): number | undefined;
295
+ send(options: MessageCreateOptions | string): Promise<Message<boolean>>;
63
296
  data: discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
297
+ get partial(): boolean;
64
298
  get id(): string;
65
299
  get type(): discord_api_types_v100.ChannelType;
66
300
  toString(): string;
67
301
  toJSON(): discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
68
302
  isTextBased(): this is TextBasedChannel;
69
303
  isVoiceBased(): this is VoiceBasedChannel;
304
+ isDM(): this is DMChannel;
305
+ isThread(): this is ThreadBasedChannel;
306
+ isPublicThread(): this is ThreadBasedChannel;
307
+ isPrivateThread(): this is ThreadBasedChannel;
308
+ isAnnouncementThread(): this is ThreadBasedChannel;
309
+ isCategory(): this is GuildCategory;
70
310
  inGuild(): this is GuildChannel;
311
+ fetch(): Promise< /*elided*/any>;
71
312
  _patch(data: Partial<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>>): void;
72
- client: Client;
73
- }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>>> & (abstract new (...args: any[]) => {
313
+ client: Client<true>;
314
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>, discord_api_types_v100.ChannelType>> & (abstract new (...args: any[]) => {
74
315
  data: discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>;
316
+ get partial(): boolean;
75
317
  get id(): string;
76
- get type(): discord_api_types_v100.ChannelType;
318
+ get type(): discord_api_types_v100.GuildChannelType;
77
319
  toString(): string;
78
320
  toJSON(): discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>;
79
321
  isTextBased(): this is TextBasedChannel;
80
322
  isVoiceBased(): this is VoiceBasedChannel;
323
+ isDM(): this is DMChannel;
324
+ isThread(): this is ThreadBasedChannel;
325
+ isPublicThread(): this is ThreadBasedChannel;
326
+ isPrivateThread(): this is ThreadBasedChannel;
327
+ isAnnouncementThread(): this is ThreadBasedChannel;
328
+ isCategory(): this is GuildCategory;
81
329
  inGuild(): this is GuildChannel;
330
+ fetch(): Promise< /*elided*/any>;
82
331
  _patch(data: Partial<discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>>): void;
83
- client: Client;
84
- }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>>>;
332
+ client: Client<true>;
333
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>>;
85
334
  declare class GuildVoiceChannel extends GuildVoiceChannel_base {}
86
335
  //#endregion
336
+ //#region src/lib/structures/channel/GuildAnnouncementChannel.d.ts
337
+ declare const GuildAnnouncementChannel_base: {
338
+ new (client: Client, data: APINewsChannel): BaseChannel<APINewsChannel, discord_api_types_v100.ChannelType.GuildAnnouncement>;
339
+ } & (abstract new (...args: any[]) => {
340
+ get parentId(): string | undefined;
341
+ get parent(): /*elided*/any | undefined;
342
+ get guildId(): string;
343
+ get guild(): Guild;
344
+ data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
345
+ get partial(): boolean;
346
+ get id(): string;
347
+ get type(): discord_api_types_v100.GuildChannelType;
348
+ toString(): string;
349
+ toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
350
+ isTextBased(): this is TextBasedChannel;
351
+ isVoiceBased(): this is VoiceBasedChannel;
352
+ isDM(): this is DMChannel;
353
+ isThread(): this is ThreadBasedChannel;
354
+ isPublicThread(): this is ThreadBasedChannel;
355
+ isPrivateThread(): this is ThreadBasedChannel;
356
+ isAnnouncementThread(): this is ThreadBasedChannel;
357
+ isCategory(): this is GuildCategory;
358
+ inGuild(): this is GuildChannel;
359
+ fetch(): Promise< /*elided*/any>;
360
+ _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
361
+ client: Client<true>;
362
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>> & (abstract new (...args: any[]) => {
363
+ get lastMessageId(): string | undefined;
364
+ get rateLimitPerUser(): number | undefined;
365
+ send(options: MessageCreateOptions | string): Promise<Message<boolean>>;
366
+ data: discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
367
+ get partial(): boolean;
368
+ get id(): string;
369
+ get type(): discord_api_types_v100.ChannelType;
370
+ toString(): string;
371
+ toJSON(): discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
372
+ isTextBased(): this is TextBasedChannel;
373
+ isVoiceBased(): this is VoiceBasedChannel;
374
+ isDM(): this is DMChannel;
375
+ isThread(): this is ThreadBasedChannel;
376
+ isPublicThread(): this is ThreadBasedChannel;
377
+ isPrivateThread(): this is ThreadBasedChannel;
378
+ isAnnouncementThread(): this is ThreadBasedChannel;
379
+ isCategory(): this is GuildCategory;
380
+ inGuild(): this is GuildChannel;
381
+ fetch(): Promise< /*elided*/any>;
382
+ _patch(data: Partial<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>>): void;
383
+ client: Client<true>;
384
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>, discord_api_types_v100.ChannelType>>;
385
+ declare class GuildAnnouncementChannel extends GuildAnnouncementChannel_base {
386
+ crosspost(messageId: string): Promise<Message<true>>;
387
+ }
388
+ //#endregion
389
+ //#region src/lib/structures/channel/GuildStageVoiceChannel.d.ts
390
+ declare const GuildStageVoiceChannel_base: {
391
+ new (client: Client, data: APIGuildStageVoiceChannel): BaseChannel<APIGuildStageVoiceChannel, discord_api_types_v100.ChannelType.GuildStageVoice>;
392
+ } & (abstract new (...args: any[]) => {
393
+ get parentId(): string | undefined;
394
+ get parent(): /*elided*/any | undefined;
395
+ get guildId(): string;
396
+ get guild(): Guild;
397
+ data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
398
+ get partial(): boolean;
399
+ get id(): string;
400
+ get type(): discord_api_types_v100.GuildChannelType;
401
+ toString(): string;
402
+ toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
403
+ isTextBased(): this is TextBasedChannel;
404
+ isVoiceBased(): this is VoiceBasedChannel;
405
+ isDM(): this is DMChannel;
406
+ isThread(): this is ThreadBasedChannel;
407
+ isPublicThread(): this is ThreadBasedChannel;
408
+ isPrivateThread(): this is ThreadBasedChannel;
409
+ isAnnouncementThread(): this is ThreadBasedChannel;
410
+ isCategory(): this is GuildCategory;
411
+ inGuild(): this is GuildChannel;
412
+ fetch(): Promise< /*elided*/any>;
413
+ _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
414
+ client: Client<true>;
415
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>> & (abstract new (...args: any[]) => {
416
+ get lastMessageId(): string | undefined;
417
+ get rateLimitPerUser(): number | undefined;
418
+ send(options: MessageCreateOptions | string): Promise<Message<boolean>>;
419
+ data: discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
420
+ get partial(): boolean;
421
+ get id(): string;
422
+ get type(): discord_api_types_v100.ChannelType;
423
+ toString(): string;
424
+ toJSON(): discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>;
425
+ isTextBased(): this is TextBasedChannel;
426
+ isVoiceBased(): this is VoiceBasedChannel;
427
+ isDM(): this is DMChannel;
428
+ isThread(): this is ThreadBasedChannel;
429
+ isPublicThread(): this is ThreadBasedChannel;
430
+ isPrivateThread(): this is ThreadBasedChannel;
431
+ isAnnouncementThread(): this is ThreadBasedChannel;
432
+ isCategory(): this is GuildCategory;
433
+ inGuild(): this is GuildChannel;
434
+ fetch(): Promise< /*elided*/any>;
435
+ _patch(data: Partial<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>>): void;
436
+ client: Client<true>;
437
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APITextBasedChannel<discord_api_types_v100.ChannelType>, discord_api_types_v100.ChannelType>> & (abstract new (...args: any[]) => {
438
+ data: discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>;
439
+ get partial(): boolean;
440
+ get id(): string;
441
+ get type(): discord_api_types_v100.GuildChannelType;
442
+ toString(): string;
443
+ toJSON(): discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>;
444
+ isTextBased(): this is TextBasedChannel;
445
+ isVoiceBased(): this is VoiceBasedChannel;
446
+ isDM(): this is DMChannel;
447
+ isThread(): this is ThreadBasedChannel;
448
+ isPublicThread(): this is ThreadBasedChannel;
449
+ isPrivateThread(): this is ThreadBasedChannel;
450
+ isAnnouncementThread(): this is ThreadBasedChannel;
451
+ isCategory(): this is GuildCategory;
452
+ inGuild(): this is GuildChannel;
453
+ fetch(): Promise< /*elided*/any>;
454
+ _patch(data: Partial<discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>>): void;
455
+ client: Client<true>;
456
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIVoiceChannelBase<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>>;
457
+ declare class GuildStageVoiceChannel extends GuildStageVoiceChannel_base {}
458
+ //#endregion
87
459
  //#region src/lib/structures/channel/BaseChannel.d.ts
88
460
  type BaseChannelPayload = APIChannelBase<ChannelType> | GatewayChannelCreateDispatchData | GatewayChannelUpdateDispatchData | APIChannel;
89
- type TextBasedChannel = GuildTextChannel | GuildVoiceChannel;
90
- type VoiceBasedChannel = GuildVoiceChannel;
91
- type GuildChannel = GuildTextChannel | GuildVoiceChannel;
92
- type Channel = TextBasedChannel | VoiceBasedChannel | GuildChannel;
93
- declare abstract class BaseChannel<D extends BaseChannelPayload> extends BaseStructure {
461
+ type TextBasedChannel = GuildTextChannel | GuildVoiceChannel | GuildStageVoiceChannel | DMChannel | GuildAnnouncementChannel | ThreadBasedChannel;
462
+ type VoiceBasedChannel = GuildVoiceChannel | GuildStageVoiceChannel;
463
+ type GuildChannel = GuildTextChannel | GuildVoiceChannel | GuildAnnouncementChannel | GuildCategory;
464
+ type Channel = TextBasedChannel | VoiceBasedChannel | GuildChannel | BaseChannel<BaseChannelPayload>;
465
+ declare class BaseChannel<D extends BaseChannelPayload, Type extends ChannelType = D["type"]> extends BaseStructure {
94
466
  data: D;
95
467
  constructor(client: Client, data: D);
468
+ get partial(): boolean;
96
469
  get id(): string;
97
- get type(): ChannelType;
470
+ get type(): Type;
98
471
  toString(): string;
99
472
  toJSON(): D;
100
473
  isTextBased(): this is TextBasedChannel;
101
474
  isVoiceBased(): this is VoiceBasedChannel;
475
+ isDM(): this is DMChannel;
476
+ isThread(): this is ThreadBasedChannel;
477
+ isPublicThread(): this is ThreadBasedChannel;
478
+ isPrivateThread(): this is ThreadBasedChannel;
479
+ isAnnouncementThread(): this is ThreadBasedChannel;
480
+ isCategory(): this is GuildCategory;
102
481
  inGuild(): this is GuildChannel;
482
+ fetch(): Promise<this>;
103
483
  _patch(data: Partial<D>): void;
104
484
  }
105
485
  //#endregion
106
486
  //#region src/lib/structures/Guild.d.ts
107
487
  type GuildPayload = APIGuild | GatewayGuildUpdateDispatchData | GatewayGuildCreateDispatchData;
108
488
  declare class Guild extends BaseStructure {
489
+ #private;
109
490
  data: GuildPayload;
110
- private cachedChannels;
491
+ readonly channels: Collection<string, Channel>;
111
492
  constructor(client: Client, data: GuildPayload);
112
493
  get id(): string;
113
494
  get name(): string;
@@ -116,10 +497,103 @@ declare class Guild extends BaseStructure {
116
497
  get owner(): string;
117
498
  get mfaLevel(): discord_api_types_v100.GuildMFALevel;
118
499
  get verificationLevel(): discord_api_types_v100.GuildVerificationLevel;
119
- get channels(): Collection<string, Channel>;
120
500
  _patch(data: Partial<GuildPayload>): void;
121
501
  }
122
502
  //#endregion
503
+ //#region src/lib/structures/Typing.d.ts
504
+ type TypingPayload = GatewayTypingStartDispatchData;
505
+ declare class Typing extends BaseStructure {
506
+ data: TypingPayload;
507
+ constructor(client: Client, data: TypingPayload);
508
+ get channelId(): string;
509
+ get guildId(): string | undefined;
510
+ get userId(): string;
511
+ get timestamp(): number;
512
+ get member(): discord_api_types_v100.APIGuildMember | undefined;
513
+ get channel(): BaseChannel<discord_api_types_v100.APIAnnouncementThreadChannel | discord_api_types_v100.APIDMChannel | discord_api_types_v100.APIGroupDMChannel | discord_api_types_v100.APIGuildCategoryChannel | discord_api_types_v100.APIGuildForumChannel | discord_api_types_v100.APIGuildMediaChannel | discord_api_types_v100.APIGuildStageVoiceChannel | discord_api_types_v100.APIGuildVoiceChannel | discord_api_types_v100.APINewsChannel | discord_api_types_v100.APIPrivateThreadChannel | discord_api_types_v100.APIPublicThreadChannel | discord_api_types_v100.APITextChannel | discord_api_types_v100.APIChannelBase<discord_api_types_v100.ChannelType> | (discord_api_types_v100.APIGuildCategoryChannel & {
514
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
515
+ guild_id: discord_api_types_globals0.Snowflake;
516
+ }) | (discord_api_types_v100.APIGuildForumChannel & {
517
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
518
+ guild_id: discord_api_types_globals0.Snowflake;
519
+ }) | (discord_api_types_v100.APIGuildMediaChannel & {
520
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
521
+ guild_id: discord_api_types_globals0.Snowflake;
522
+ }) | (discord_api_types_v100.APIGuildStageVoiceChannel & {
523
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
524
+ guild_id: discord_api_types_globals0.Snowflake;
525
+ }) | (discord_api_types_v100.APIGuildVoiceChannel & {
526
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
527
+ guild_id: discord_api_types_globals0.Snowflake;
528
+ }) | (discord_api_types_v100.APINewsChannel & {
529
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
530
+ guild_id: discord_api_types_globals0.Snowflake;
531
+ }) | (discord_api_types_v100.APITextChannel & {
532
+ type: Exclude<discord_api_types_v100.GuildChannelType, discord_api_types_v100.ThreadChannelType>;
533
+ guild_id: discord_api_types_globals0.Snowflake;
534
+ }), discord_api_types_v100.ChannelType> | undefined;
535
+ get guild(): Guild | undefined;
536
+ }
537
+ //#endregion
538
+ //#region src/lib/structures/Tag.d.ts
539
+ declare class Tag extends BaseStructure {
540
+ data: APIGuildForumTag;
541
+ constructor(client: Client, data: APIGuildForumTag);
542
+ get id(): string;
543
+ get name(): string;
544
+ get moderated(): boolean;
545
+ get emojiId(): string | undefined;
546
+ get emojiName(): string | undefined;
547
+ _patch(data: Partial<APIGuildForumTag>): void;
548
+ }
549
+ //#endregion
550
+ //#region src/lib/structures/channel/GuildForumChannel.d.ts
551
+ interface CreateForumPostOptions {
552
+ name: string;
553
+ message: MessageCreateOptions | string;
554
+ autoArchiveDuration?: ThreadAutoArchiveDuration;
555
+ rateLimitPerUser?: number;
556
+ appliedTags?: string[];
557
+ }
558
+ declare const GuildForumChannel_base: {
559
+ new (client: Client, data: APIGuildForumChannel): BaseChannel<APIGuildForumChannel, discord_api_types_v100.ChannelType.GuildForum>;
560
+ } & (abstract new (...args: any[]) => {
561
+ get parentId(): string | undefined;
562
+ get parent(): /*elided*/any | undefined;
563
+ get guildId(): string;
564
+ get guild(): Guild;
565
+ data: discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
566
+ get partial(): boolean;
567
+ get id(): string;
568
+ get type(): discord_api_types_v100.GuildChannelType;
569
+ toString(): string;
570
+ toJSON(): discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>;
571
+ isTextBased(): this is TextBasedChannel;
572
+ isVoiceBased(): this is VoiceBasedChannel;
573
+ isDM(): this is DMChannel;
574
+ isThread(): this is ThreadBasedChannel;
575
+ isPublicThread(): this is ThreadBasedChannel;
576
+ isPrivateThread(): this is ThreadBasedChannel;
577
+ isAnnouncementThread(): this is ThreadBasedChannel;
578
+ isCategory(): this is GuildCategory;
579
+ inGuild(): this is GuildChannel;
580
+ fetch(): Promise< /*elided*/any>;
581
+ _patch(data: Partial<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>>): void;
582
+ client: Client<true>;
583
+ }) & _bakit_utils0.AbstractConstructor<BaseChannel<discord_api_types_v100.APIGuildChannel<discord_api_types_v100.GuildChannelType>, discord_api_types_v100.GuildChannelType>>;
584
+ declare class GuildForumChannel extends GuildForumChannel_base {
585
+ #private;
586
+ constructor(client: Client, data: APIGuildForumChannel);
587
+ get topic(): string | undefined;
588
+ get defaultAutoArchiveDuration(): ThreadAutoArchiveDuration | undefined;
589
+ get defaultSortOrder(): SortOrderType | null | undefined;
590
+ get defaultForumLayout(): ForumLayoutType | undefined;
591
+ get defaultThreadRateLimitPerUser(): number | undefined;
592
+ get nsfw(): boolean;
593
+ get tags(): Collection<string, Tag>;
594
+ _patch(data: Partial<APIGuildForumChannel>): void;
595
+ }
596
+ //#endregion
123
597
  //#region src/lib/structures/User.d.ts
124
598
  type UserPayload = APIUser | GatewayReadyDispatchData["user"];
125
599
  declare class User extends BaseStructure {
@@ -156,81 +630,161 @@ declare class User extends BaseStructure {
156
630
  extension?: "png" | "jpg" | "webp" | "gif";
157
631
  }): string;
158
632
  equals(other: User | string): boolean;
633
+ createDM(force?: boolean): Promise<DMChannel>;
634
+ send(options: MessageCreateOptions | string): Promise<Message<false>>;
635
+ _patch(data: Partial<UserPayload>): void;
159
636
  toJSON(): APIUser;
160
637
  toString(): string;
161
638
  }
162
639
  //#endregion
163
- //#region src/lib/client/ClientHelper.d.ts
164
- interface MessageCreateOptions {
165
- content?: string;
166
- tts?: boolean;
167
- embeds?: APIEmbed[];
168
- allowedMentions?: APIAllowedMentions;
169
- messageReference?: APIMessageReference;
170
- flags?: number;
640
+ //#region src/lib/utils/IntentsBitField.d.ts
641
+ type IntentResolvable = number | bigint | GatewayIntentBits | GatewayIntentBits[];
642
+ declare class IntentsBitField {
643
+ private readonly value;
644
+ constructor(input: IntentResolvable);
645
+ static resolve(input: IntentResolvable): bigint;
646
+ has(intent: GatewayIntentBits): boolean;
647
+ toBigInt(): bigint;
648
+ toNumber(): number;
649
+ toJSON(): string;
650
+ toString(): string;
171
651
  }
172
- type MessageReplyOptions = Omit<MessageCreateOptions, "messageReference">;
173
- declare class ClientHelper {
174
- readonly client: Client;
175
- constructor(client: Client);
176
- fetchMessage(channelId: string, messageId: string): Promise<Message>;
177
- deleteMessage(channelId: string, messageId: string): Promise<unknown>;
178
- createMessage(channelId: string, options: MessageCreateOptions): Promise<APIMessage>;
179
- replyMessage(channelId: string, messageId: string, options: MessageReplyOptions): Promise<APIMessage>;
180
- fetchGuild(guildId: string): Promise<Guild>;
181
- static toAPICreateMessagePayload(options: MessageCreateOptions): {
182
- content: string | undefined;
183
- tts: boolean | undefined;
184
- embeds: APIEmbed[] | undefined;
185
- allowed_mentions: APIAllowedMentions | undefined;
186
- message_reference: APIMessageReference | undefined;
187
- flags: number | undefined;
188
- };
652
+ //#endregion
653
+ //#region src/lib/utils/cache/adapters/BaseCacheAdapter.d.ts
654
+ declare abstract class BaseCacheAdapter<Key, Value> {
655
+ abstract get(key: Key): Awaitable$1<Value | undefined>;
656
+ abstract set(key: Key, value: Value, ttl?: number): Awaitable$1<void>;
657
+ abstract delete(key: Key): Awaitable$1<void>;
658
+ abstract clear(): Awaitable$1<void>;
659
+ abstract has(key: Key): Awaitable$1<boolean>;
660
+ abstract sweep(filter: (data: Value) => boolean): Awaitable$1<void>;
661
+ }
662
+ //#endregion
663
+ //#region src/lib/utils/cache/adapters/LocalCacheAdapter.d.ts
664
+ interface LocalCacheTTLEntry<Value> {
665
+ value: Value;
666
+ expiresAt?: number;
667
+ }
668
+ declare class LocalCacheAdapter<Key, Value> extends BaseCacheAdapter<Key, Value> {
669
+ #private;
670
+ collection: Collection<Key, LocalCacheTTLEntry<Value>>;
671
+ get(key: Key): Value | undefined;
672
+ set(key: Key, value: Value, ttl?: number): void;
673
+ delete(key: Key): void;
674
+ clear(): void;
675
+ has(key: Key): boolean;
676
+ find(filter: (data: Value) => boolean): Value | undefined;
677
+ forEach(callback: (value: Value, key: Key) => void): void;
678
+ map<T>(callback: (value: Value, key: Key) => T): T[];
679
+ sweep(filter: (data: Value) => boolean): void;
680
+ sweepTTL(): void;
681
+ }
682
+ //#endregion
683
+ //#region src/lib/utils/cache/HybridCache.d.ts
684
+ declare class HybridCache<Key, Value> {
685
+ remote?: BaseCacheAdapter<Key, Value> | undefined;
686
+ defaultTTL?: number | undefined;
687
+ local: LocalCacheAdapter<Key, Value>;
688
+ constructor(remote?: BaseCacheAdapter<Key, Value> | undefined, defaultTTL?: number | undefined);
689
+ get(key: Key): Promise<Value | undefined>;
690
+ sweep(filter: (data: Value) => boolean): Promise<void>;
691
+ set(key: Key, value: Value, ttl?: number | undefined): Promise<void>;
692
+ delete(key: Key): Promise<void>;
693
+ clear(): Promise<void>;
694
+ has(key: Key): Promise<boolean>;
695
+ }
696
+ //#endregion
697
+ //#region src/lib/managers/client/ClientCacheManager.d.ts
698
+ interface ClientCacheManagerOptions {
699
+ users?: ClientModuleCacheOptions<User> | boolean;
700
+ messages?: ClientModuleCacheOptions<Message> | boolean;
701
+ }
702
+ interface ClientModuleCacheOptions<Value> {
703
+ enabled: boolean;
704
+ adapter?: BaseCacheAdapter<string, Value>;
705
+ ttl?: number;
706
+ sweeper?: ClientModuleCacheSweeperOptions<Value>;
707
+ }
708
+ interface ClientModuleCacheSweeperOptions<Value> {
709
+ interval: number;
710
+ filter: (data: Value) => boolean;
711
+ }
712
+ declare class ClientCacheManager {
713
+ #private;
714
+ options: ClientCacheManagerOptions;
715
+ channels: LocalCacheAdapter<string, Channel>;
716
+ guilds: LocalCacheAdapter<string, Guild>;
717
+ constructor(options: ClientCacheManagerOptions);
718
+ get users(): HybridCache<string, User>;
719
+ get messages(): HybridCache<string, Message<boolean>>;
720
+ isModuleEnabled(module: keyof ClientCacheManagerOptions): boolean;
721
+ resolve<Value>(cache: HybridCache<string, Value> | LocalCacheAdapter<string, Value>, id: string, factory: () => Value, patch?: (value: Value) => void): Promise<Value>;
722
+ resolveLocal<Value>(cache: LocalCacheAdapter<string, Value>, id: string, factory: () => Value, patch?: (value: Value) => void): Value;
189
723
  }
190
724
  //#endregion
191
725
  //#region src/lib/structures/Message.d.ts
192
726
  type MessagePayload = APIMessage | GatewayMessageCreateDispatchData | GatewayMessageUpdateDispatchData;
193
- declare class Message extends BaseStructure {
727
+ declare class Message<InGuild extends boolean = boolean> extends BaseStructure {
728
+ #private;
194
729
  data: MessagePayload;
195
- protected cachedAuthor?: User;
196
730
  constructor(client: Client, data: MessagePayload);
197
731
  get partial(): boolean;
198
732
  get content(): string;
199
733
  get id(): string;
200
734
  get channelId(): string;
201
- get channel(): TextBasedChannel;
202
- get guildId(): string | undefined;
203
- get guild(): Guild | undefined;
735
+ get channel(): InGuild extends true ? TextBasedChannel & GuildChannel : TextBasedChannel;
736
+ get guildId(): InGuild extends true ? string : undefined;
737
+ get guild(): InGuild extends true ? Guild : undefined;
738
+ /**
739
+ * The author of this message.
740
+ *
741
+ * **Note:** This property returns the cached `User` synchronously.
742
+ * It may be stale if the users cache has short lifetime or uses an asynchronous remote store.
743
+ * To ensure the author is up-to-date, use the `fetchAuthor()` method instead.
744
+ */
204
745
  get author(): User;
205
746
  get createdAt(): Date;
206
747
  get editedAt(): Date | undefined;
207
748
  get createdTimestamp(): number;
208
749
  get editedTimestamp(): number | undefined;
209
750
  get url(): string;
751
+ inGuild(): this is Message<true>;
210
752
  fetch(): Promise<Message>;
211
- reply(options: MessageReplyOptions): Promise<APIMessage>;
212
- sendToChannel(options: MessageReplyOptions): Promise<APIMessage>;
753
+ /**
754
+ * Fetches the author of this message from cache or Discord API.
755
+ *
756
+ * **Note:** It is recommended to use this method instead of the `author` property
757
+ * if the users cache has short lifetime or is backed by an asynchronous remote cache.
758
+ *
759
+ * @param force - Whether to bypass the cache and force a request to the API.
760
+ * @returns A promise that resolves to the `User` who authored this message.
761
+ */
762
+ fetchAuthor(force?: boolean): Promise<User>;
763
+ reply(options: string | MessageReplyOptions): Promise<Message<boolean>>;
764
+ edit(options: string | MessageEditOptions): Promise<Message<boolean>>;
765
+ _patch(data: Partial<MessagePayload>): Promise<void>;
213
766
  toJSON(): MessagePayload;
214
767
  toString(): string;
215
768
  }
216
769
  //#endregion
770
+ //#region src/lib/client/ClientHelper.d.ts
771
+ declare class ClientHelper {
772
+ readonly client: Client;
773
+ constructor(client: Client);
774
+ fetchUser(userId: string, force?: boolean): Promise<User>;
775
+ createDM(userId: string, force?: boolean): Promise<DMChannel>;
776
+ fetchMessage(channelId: string, messageId: string, force?: boolean): Promise<Message<boolean>>;
777
+ deleteMessage(channelId: string, messageId: string): Promise<void>;
778
+ fetchGuild(guildId: string, force?: boolean): Promise<Guild>;
779
+ fetchChannel<C extends Channel>(channelId: string, force?: boolean): Promise<C | undefined>;
780
+ crosspostMessage(channelId: string, messageId: string): Promise<Message<true>>;
781
+ }
782
+ //#endregion
217
783
  //#region src/lib/client/Partial.d.ts
218
784
  declare enum Partial$1 {
219
785
  Message = 0,
220
- User = 1
221
- }
222
- //#endregion
223
- //#region src/lib/utils/IntentsBitField.d.ts
224
- type IntentResolvable = number | bigint | GatewayIntentBits | GatewayIntentBits[];
225
- declare class IntentsBitField {
226
- private readonly value;
227
- constructor(input: IntentResolvable);
228
- static resolve(input: IntentResolvable): bigint;
229
- has(intent: GatewayIntentBits): boolean;
230
- toBigInt(): bigint;
231
- toNumber(): number;
232
- toJSON(): string;
233
- toString(): string;
786
+ User = 1,
787
+ Channel = 2
234
788
  }
235
789
  //#endregion
236
790
  //#region src/lib/client/Client.d.ts
@@ -239,6 +793,7 @@ interface ClientOptions {
239
793
  intents: IntentResolvable | IntentsBitField;
240
794
  sharding?: ClientShardingOptions;
241
795
  partials?: Partial$1[];
796
+ cache?: ClientCacheManagerOptions;
242
797
  }
243
798
  type ClientShardingOptions = Omit<ShardingManagerOptions$1, "token" | "intents">;
244
799
  interface ClientEvents {
@@ -248,11 +803,7 @@ interface ClientEvents {
248
803
  raw: [shardId: number, payload: GatewayReceivePayload];
249
804
  messageCreate: [message: Message];
250
805
  messageUpdate: [message: Message];
251
- messageDelete: [message: {
252
- id: string;
253
- channelId: string;
254
- guildId?: string;
255
- }];
806
+ messageDelete: [message: Message];
256
807
  userUpdate: [user: User];
257
808
  guildCreate: [guild: Guild];
258
809
  guildAvailable: [guild: Guild];
@@ -261,8 +812,12 @@ interface ClientEvents {
261
812
  channelCreate: [channel: Channel];
262
813
  channelUpdate: [channel: Channel];
263
814
  channelDelete: [channel: Channel];
815
+ threadCreate: [thread: ThreadBasedChannel];
816
+ threadUpdate: [thread: ThreadBasedChannel];
817
+ threadDelete: [thread: ThreadBasedChannel];
818
+ typingStart: [typing: Typing];
264
819
  }
265
- declare class Client extends EventEmitter<ClientEvents> {
820
+ declare class Client<Ready extends boolean = boolean> extends EventEmitter<ClientEvents> {
266
821
  #private;
267
822
  readonly options: Omit<Required<ClientOptions>, "partials" | "intents"> & {
268
823
  partials: Set<Partial$1>;
@@ -270,13 +825,18 @@ declare class Client extends EventEmitter<ClientEvents> {
270
825
  };
271
826
  readonly shards: ShardingManager$1;
272
827
  readonly rest: RESTLike$1;
828
+ /**
829
+ * @private
830
+ * @deprecated
831
+ */
273
832
  readonly helper: ClientHelper;
274
- readonly guilds: Collection<string, Guild>;
833
+ readonly cache: ClientCacheManager;
834
+ readonly channels: ClientChannelManager;
275
835
  constructor(options: ClientOptions, rest?: RESTLike$1);
276
- get user(): User | undefined;
836
+ get user(): Ready extends true ? User : User | undefined;
277
837
  login(): Promise<void>;
278
838
  }
279
- declare function createClient(options: ClientOptions): Client;
839
+ declare function createClient(options: ClientOptions): Client<boolean>;
280
840
  //#endregion
281
- export { type AbstractConstructor, type Awaitable, BaseChannel, BaseChannelPayload, type BaseRESTEvents, Channel, Client, ClientEvents, ClientHelper, ClientOptions, ClientShardingOptions, Cluster, type ClusterEvents, type ClusterOptions, type Constructor, DEFAULT_REST_OPTIONS, discord_api_types_v100 as DiscordAPIV10, DiscordHTTPError, type DiscordHTTPErrorRequest, type DiscordHTTPFlattenedError, type DiscordHTTPValidationError, type FunctionLike, Guild, GuildChannel, GuildPayload, GuildTextChannel, GuildVoiceChannel, Intent, IntentResolvable, IntentsBitField, Message, MessageCreateOptions, MessagePayload, MessageReplyOptions, Partial$1 as Partial, type Promisify, type PromisifyValue, REST, RESTAdapter, type RESTAdapterEvents, type RESTEndpoint, type RESTEvents, type RESTLike, RESTMethod, type RESTOptions, type RESTProxyOptions, type RESTRequestFn, type RESTRequestOptions, type RPCHandler, type RejectFn, type ResolveFn, Service, type ServiceClientRuntime, ServiceDriver, type ServiceOptions, ServiceProcess, type ServiceProcessEvents, type ServiceServerRuntime, ServiceState, Shard, type ShardEvents, type ShardOptions, ShardState, ShardStrategy, ShardingManager, type ShardingManagerEvents, type ShardingManagerOptions, TextBasedChannel, TransportClient, type TransportClientEvents, TransportServer, type TransportServerEvents, User, UserPayload, VoiceBasedChannel, capitalize, createClient, createREST, createRESTAdapter, createService, createTransportClient, createTransportServer, instanceToObject, isCommonJS, isESM, isPlainObject, isPromiseLike, promisify, sleep };
841
+ export { type AbstractConstructor, AnnouncementThread, type Awaitable, BaseCacheAdapter, BaseChannel, BaseChannelPayload, type BaseRESTEvents, Channel, Client, ClientEvents, ClientHelper, ClientOptions, ClientShardingOptions, Cluster, type ClusterEvents, type ClusterOptions, type Constructor, CreateForumPostOptions, DEFAULT_REST_OPTIONS, DMChannel, discord_api_types_v100 as DiscordAPIV10, DiscordHTTPError, type DiscordHTTPErrorRequest, type DiscordHTTPFlattenedError, type DiscordHTTPValidationError, type FunctionLike, Guild, GuildAnnouncementChannel, GuildCategory, GuildChannel, GuildForumChannel, GuildPayload, GuildStageVoiceChannel, GuildTextChannel, GuildVoiceChannel, HybridCache, Intent, IntentResolvable, IntentsBitField, LocalCacheAdapter, LocalCacheTTLEntry, Message, MessagePayload, Partial$1 as Partial, PrivateThread, type Promisify, type PromisifyValue, PublicThread, REST, RESTAdapter, type RESTAdapterEvents, type RESTEndpoint, type RESTEvents, type RESTLike, RESTMethod, type RESTOptions, type RESTProxyOptions, type RESTRequestFn, type RESTRequestOptions, type RPCHandler, type RejectFn, type ResolveFn, Service, type ServiceClientRuntime, ServiceDriver, type ServiceOptions, ServiceProcess, type ServiceProcessEvents, type ServiceServerRuntime, ServiceState, Shard, type ShardEvents, type ShardOptions, ShardState, ShardStrategy, ShardingManager, type ShardingManagerEvents, type ShardingManagerOptions, Tag, TextBasedChannel, ThreadBasedChannel, ThreadChannel, TransportClient, type TransportClientEvents, TransportServer, type TransportServerEvents, Typing, TypingPayload, User, UserPayload, VoiceBasedChannel, capitalize, createClient, createREST, createRESTAdapter, createService, createTransportClient, createTransportServer, instanceToObject, isCommonJS, isESM, isPlainObject, isPromiseLike, promisify, sleep };
282
842
  //# sourceMappingURL=index.d.cts.map