bakit 3.0.0 → 3.0.1

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.ts DELETED
@@ -1,276 +0,0 @@
1
- import { ShardingManagerOptions, ShardingManager } from '@bakit/gateway';
2
- export { Cluster, ClusterEvents, ClusterOptions, Shard, ShardEvents, ShardOptions, ShardState, ShardStrategy, ShardingManager, ShardingManagerEvents, ShardingManagerOptions } from '@bakit/gateway';
3
- import { RESTLike } from '@bakit/rest';
4
- export { BaseRESTEvents, DEFAULT_REST_OPTIONS, DiscordHTTPError, DiscordHTTPErrorRequest, DiscordHTTPFlattenedError, DiscordHTTPValidationError, REST, RESTAdapter, RESTAdapterEvents, RESTEndpoint, RESTEvents, RESTLike, RESTMethod, RESTOptions, RESTProxyOptions, RESTRequestFn, RESTRequestOptions, createREST, createRESTAdapter } from '@bakit/rest';
5
- export { RPCHandler, Service, ServiceClientRuntime, ServiceDriver, ServiceOptions, ServiceProcess, ServiceProcessEvents, ServiceServerRuntime, ServiceState, TransportClient, TransportClientEvents, TransportServer, TransportServerEvents, createService, createTransportClient, createTransportServer } from '@bakit/service';
6
- import * as _bakit_utils from '@bakit/utils';
7
- export { AbstractConstructor, Awaitable, Constructor, FunctionLike, Promisify, PromisifyValue, RejectFn, ResolveFn, capitalize, instanceToObject, isCommonJS, isESM, isPlainObject, isPromiseLike, promisify, sleep } from '@bakit/utils';
8
- import EventEmitter from 'node:events';
9
- import { Collection } from '@discordjs/collection';
10
- import * as discord_api_types_v10 from 'discord-api-types/v10';
11
- import { APITextBasedChannel, ChannelType, APIGuildVoiceChannel, APIChannelBase, GatewayChannelCreateDispatchData, GatewayChannelUpdateDispatchData, APIChannel, APIGuild, GatewayGuildUpdateDispatchData, GatewayGuildCreateDispatchData, APIUser, GatewayReadyDispatchData, APIEmbed, APIAllowedMentions, APIMessageReference, APIMessage, GatewayMessageCreateDispatchData, GatewayMessageUpdateDispatchData, GatewayIntentBits, GatewayDispatchPayload, GatewayReceivePayload } from 'discord-api-types/v10';
12
- export { discord_api_types_v10 as DiscordAPIV10 };
13
- export { GatewayIntentBits as Intent } from 'discord-api-types/v10';
14
-
15
- declare class BaseStructure {
16
- client: Client;
17
- constructor(client: Client);
18
- toJSON(): {};
19
- }
20
-
21
- declare const GuildTextChannel_base: (abstract new (client: Client, data: APITextBasedChannel<ChannelType.GuildText>) => BaseChannel<APITextBasedChannel<ChannelType.GuildText>>) & (abstract new (...args: any[]) => {
22
- get guildId(): string;
23
- get guild(): Guild;
24
- data: discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>;
25
- get id(): string;
26
- get type(): ChannelType;
27
- toString(): string;
28
- toJSON(): discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>;
29
- isTextBased(): this is TextBasedChannel;
30
- isVoiceBased(): this is VoiceBasedChannel;
31
- inGuild(): this is GuildChannel;
32
- _patch(data: Partial<discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>>): void;
33
- client: Client;
34
- }) & _bakit_utils.AbstractConstructor<BaseChannel<discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>>> & (abstract new (...args: any[]) => {
35
- send(options: MessageCreateOptions): Promise<discord_api_types_v10.APIMessage>;
36
- data: APITextBasedChannel<ChannelType>;
37
- get id(): string;
38
- get type(): ChannelType;
39
- toString(): string;
40
- toJSON(): APITextBasedChannel<ChannelType>;
41
- isTextBased(): this is TextBasedChannel;
42
- isVoiceBased(): this is VoiceBasedChannel;
43
- inGuild(): this is GuildChannel;
44
- _patch(data: Partial<APITextBasedChannel<ChannelType>>): void;
45
- client: Client;
46
- }) & _bakit_utils.AbstractConstructor<BaseChannel<APITextBasedChannel<ChannelType>>>;
47
- declare class GuildTextChannel extends GuildTextChannel_base {
48
- }
49
-
50
- declare const GuildVoiceChannel_base: (abstract new (client: Client, data: APIGuildVoiceChannel) => BaseChannel<APIGuildVoiceChannel>) & (abstract new (...args: any[]) => {
51
- get guildId(): string;
52
- get guild(): Guild;
53
- data: discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>;
54
- get id(): string;
55
- get type(): discord_api_types_v10.ChannelType;
56
- toString(): string;
57
- toJSON(): discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>;
58
- isTextBased(): this is TextBasedChannel;
59
- isVoiceBased(): this is VoiceBasedChannel;
60
- inGuild(): this is GuildChannel;
61
- _patch(data: Partial<discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>>): void;
62
- client: Client;
63
- }) & _bakit_utils.AbstractConstructor<BaseChannel<discord_api_types_v10.APIGuildChannel<discord_api_types_v10.GuildChannelType>>> & (abstract new (...args: any[]) => {
64
- send(options: MessageCreateOptions): Promise<discord_api_types_v10.APIMessage>;
65
- data: discord_api_types_v10.APITextBasedChannel<discord_api_types_v10.ChannelType>;
66
- get id(): string;
67
- get type(): discord_api_types_v10.ChannelType;
68
- toString(): string;
69
- toJSON(): discord_api_types_v10.APITextBasedChannel<discord_api_types_v10.ChannelType>;
70
- isTextBased(): this is TextBasedChannel;
71
- isVoiceBased(): this is VoiceBasedChannel;
72
- inGuild(): this is GuildChannel;
73
- _patch(data: Partial<discord_api_types_v10.APITextBasedChannel<discord_api_types_v10.ChannelType>>): void;
74
- client: Client;
75
- }) & _bakit_utils.AbstractConstructor<BaseChannel<discord_api_types_v10.APITextBasedChannel<discord_api_types_v10.ChannelType>>> & (abstract new (...args: any[]) => {
76
- data: discord_api_types_v10.APIVoiceChannelBase<discord_api_types_v10.GuildChannelType>;
77
- get id(): string;
78
- get type(): discord_api_types_v10.ChannelType;
79
- toString(): string;
80
- toJSON(): discord_api_types_v10.APIVoiceChannelBase<discord_api_types_v10.GuildChannelType>;
81
- isTextBased(): this is TextBasedChannel;
82
- isVoiceBased(): this is VoiceBasedChannel;
83
- inGuild(): this is GuildChannel;
84
- _patch(data: Partial<discord_api_types_v10.APIVoiceChannelBase<discord_api_types_v10.GuildChannelType>>): void;
85
- client: Client;
86
- }) & _bakit_utils.AbstractConstructor<BaseChannel<discord_api_types_v10.APIVoiceChannelBase<discord_api_types_v10.GuildChannelType>>>;
87
- declare class GuildVoiceChannel extends GuildVoiceChannel_base {
88
- }
89
-
90
- type BaseChannelPayload = APIChannelBase<ChannelType> | GatewayChannelCreateDispatchData | GatewayChannelUpdateDispatchData | APIChannel;
91
- type TextBasedChannel = GuildTextChannel | GuildVoiceChannel;
92
- type VoiceBasedChannel = GuildVoiceChannel;
93
- type GuildChannel = GuildTextChannel | GuildVoiceChannel;
94
- type Channel = TextBasedChannel | VoiceBasedChannel | GuildChannel;
95
- declare abstract class BaseChannel<D extends BaseChannelPayload> extends BaseStructure {
96
- data: D;
97
- constructor(client: Client, data: D);
98
- get id(): string;
99
- get type(): ChannelType;
100
- toString(): string;
101
- toJSON(): D;
102
- isTextBased(): this is TextBasedChannel;
103
- isVoiceBased(): this is VoiceBasedChannel;
104
- inGuild(): this is GuildChannel;
105
- _patch(data: Partial<D>): void;
106
- }
107
-
108
- type GuildPayload = APIGuild | GatewayGuildUpdateDispatchData | GatewayGuildCreateDispatchData;
109
- declare class Guild extends BaseStructure {
110
- data: GuildPayload;
111
- private cachedChannels;
112
- constructor(client: Client, data: GuildPayload);
113
- get id(): string;
114
- get name(): string;
115
- get icon(): string | null;
116
- get banner(): string | null;
117
- get owner(): string;
118
- get mfaLevel(): discord_api_types_v10.GuildMFALevel;
119
- get verificationLevel(): discord_api_types_v10.GuildVerificationLevel;
120
- get channels(): Collection<string, Channel>;
121
- _patch(data: Partial<GuildPayload>): void;
122
- }
123
-
124
- type UserPayload = APIUser | GatewayReadyDispatchData["user"];
125
- declare class User extends BaseStructure {
126
- data: UserPayload;
127
- constructor(client: Client, data: UserPayload);
128
- get id(): string;
129
- get username(): string;
130
- get discriminator(): string;
131
- get globalName(): string | null;
132
- get tag(): string;
133
- get displayName(): string;
134
- get avatar(): string | undefined;
135
- get bot(): boolean;
136
- get system(): boolean;
137
- get mfaEnabled(): boolean | undefined;
138
- get locale(): string | undefined;
139
- get verified(): boolean | undefined;
140
- get email(): string | null | undefined;
141
- get flags(): discord_api_types_v10.UserFlags | undefined;
142
- get premiumType(): discord_api_types_v10.UserPremiumType | undefined;
143
- get publicFlags(): discord_api_types_v10.UserFlags | undefined;
144
- get banner(): string | null | undefined;
145
- get accentColor(): number | undefined;
146
- get createdAt(): Date;
147
- get createdTimestamp(): number;
148
- get hexAccentColor(): string | undefined;
149
- get defaultAvatarURL(): string;
150
- getAvatarURL(options?: {
151
- size?: number;
152
- extension?: "png" | "jpg" | "webp" | "gif";
153
- }): string | undefined;
154
- getDisplayAvatarURL(options?: {
155
- size?: number;
156
- extension?: "png" | "jpg" | "webp" | "gif";
157
- }): string;
158
- equals(other: User | string): boolean;
159
- toJSON(): APIUser;
160
- toString(): string;
161
- }
162
-
163
- interface MessageCreateOptions {
164
- content?: string;
165
- tts?: boolean;
166
- embeds?: APIEmbed[];
167
- allowedMentions?: APIAllowedMentions;
168
- messageReference?: APIMessageReference;
169
- flags?: number;
170
- }
171
- type MessageReplyOptions = Omit<MessageCreateOptions, "messageReference">;
172
- declare class ClientHelper {
173
- readonly client: Client;
174
- constructor(client: Client);
175
- fetchMessage(channelId: string, messageId: string): Promise<Message>;
176
- deleteMessage(channelId: string, messageId: string): Promise<unknown>;
177
- createMessage(channelId: string, options: MessageCreateOptions): Promise<APIMessage>;
178
- replyMessage(channelId: string, messageId: string, options: MessageReplyOptions): Promise<APIMessage>;
179
- fetchGuild(guildId: string): Promise<Guild>;
180
- static toAPICreateMessagePayload(options: MessageCreateOptions): {
181
- content: string | undefined;
182
- tts: boolean | undefined;
183
- embeds: APIEmbed[] | undefined;
184
- allowed_mentions: APIAllowedMentions | undefined;
185
- message_reference: APIMessageReference | undefined;
186
- flags: number | undefined;
187
- };
188
- }
189
-
190
- type MessagePayload = APIMessage | GatewayMessageCreateDispatchData | GatewayMessageUpdateDispatchData;
191
- declare class Message extends BaseStructure {
192
- data: MessagePayload;
193
- protected cachedAuthor?: User;
194
- constructor(client: Client, data: MessagePayload);
195
- get partial(): boolean;
196
- get content(): string;
197
- get id(): string;
198
- get channelId(): string;
199
- get channel(): TextBasedChannel;
200
- get guildId(): string | undefined;
201
- get guild(): Guild | undefined;
202
- get author(): User;
203
- get createdAt(): Date;
204
- get editedAt(): Date | undefined;
205
- get createdTimestamp(): number;
206
- get editedTimestamp(): number | undefined;
207
- get url(): string;
208
- fetch(): Promise<Message>;
209
- reply(options: MessageReplyOptions): Promise<APIMessage>;
210
- sendToChannel(options: MessageReplyOptions): Promise<APIMessage>;
211
- toJSON(): MessagePayload;
212
- toString(): string;
213
- }
214
-
215
- declare enum Partial$1 {
216
- Message = 0,
217
- User = 1
218
- }
219
-
220
- type IntentResolvable = number | bigint | GatewayIntentBits | GatewayIntentBits[];
221
- declare class IntentsBitField {
222
- private readonly value;
223
- constructor(input: IntentResolvable);
224
- static resolve(input: IntentResolvable): bigint;
225
- has(intent: GatewayIntentBits): boolean;
226
- toBigInt(): bigint;
227
- toNumber(): number;
228
- toJSON(): string;
229
- toString(): string;
230
- }
231
-
232
- interface ClientOptions {
233
- token: string;
234
- intents: IntentResolvable | IntentsBitField;
235
- sharding?: ClientShardingOptions;
236
- partials?: Partial$1[];
237
- }
238
- type ClientShardingOptions = Omit<ShardingManagerOptions, "token" | "intents">;
239
- interface ClientEvents {
240
- ready: [user: User];
241
- error: [error: Error];
242
- dispatch: [shardId: number, payload: GatewayDispatchPayload];
243
- raw: [shardId: number, payload: GatewayReceivePayload];
244
- messageCreate: [message: Message];
245
- messageUpdate: [message: Message];
246
- messageDelete: [message: {
247
- id: string;
248
- channelId: string;
249
- guildId?: string;
250
- }];
251
- userUpdate: [user: User];
252
- guildCreate: [guild: Guild];
253
- guildAvailable: [guild: Guild];
254
- guildUpdate: [guild: Guild];
255
- guildDelete: [guild: Guild];
256
- channelCreate: [channel: Channel];
257
- channelUpdate: [channel: Channel];
258
- channelDelete: [channel: Channel];
259
- }
260
- declare class Client extends EventEmitter<ClientEvents> {
261
- #private;
262
- readonly options: Omit<Required<ClientOptions>, "partials" | "intents"> & {
263
- partials: Set<Partial$1>;
264
- intents: IntentsBitField;
265
- };
266
- readonly shards: ShardingManager;
267
- readonly rest: RESTLike;
268
- readonly helper: ClientHelper;
269
- readonly guilds: Collection<string, Guild>;
270
- constructor(options: ClientOptions, rest?: RESTLike);
271
- get user(): User | undefined;
272
- login(): Promise<void>;
273
- }
274
- declare function createClient(options: ClientOptions): Client;
275
-
276
- export { BaseChannel, type BaseChannelPayload, type Channel, Client, type ClientEvents, ClientHelper, type ClientOptions, type ClientShardingOptions, Guild, type GuildChannel, type GuildPayload, GuildTextChannel, GuildVoiceChannel, type IntentResolvable, IntentsBitField, Message, type MessageCreateOptions, type MessagePayload, type MessageReplyOptions, Partial$1 as Partial, type TextBasedChannel, User, type UserPayload, type VoiceBasedChannel, createClient };