@stoatx/client 0.1.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.
@@ -0,0 +1,1338 @@
1
+ import { EventEmitter } from 'events';
2
+ import * as util from 'node:util';
3
+
4
+ declare class GatewayManager {
5
+ private client;
6
+ private ws;
7
+ private pingInterval;
8
+ private token;
9
+ private reconnectAttempts;
10
+ private readonly maxReconnectWait;
11
+ private isIntentionalClose;
12
+ constructor(client: Client);
13
+ connect(token: string): Promise<void>;
14
+ private handleMessage;
15
+ private startPingLoop;
16
+ private send;
17
+ private reconnect;
18
+ disconnect(): void;
19
+ }
20
+
21
+ declare class RESTManager {
22
+ private client;
23
+ private baseURL;
24
+ private token;
25
+ private buckets;
26
+ constructor(client: Client);
27
+ setToken(token: string): void;
28
+ /**
29
+ * Generates a local identifier for the bucket based on method and path.
30
+ */
31
+ private getRouteKey;
32
+ makeRequest(method: string, endpoint: string, body?: any): Promise<any>;
33
+ private execute;
34
+ /**
35
+ * Uploads a file to Stoat's CDN and returns the File ID
36
+ */
37
+ uploadFile(filename: string, fileBuffer: Buffer | Blob): Promise<string>;
38
+ get(endpoint: string): Promise<any>;
39
+ post(endpoint: string, body: any): Promise<any>;
40
+ patch(endpoint: string, body: any): Promise<any>;
41
+ delete(endpoint: string): Promise<any>;
42
+ put(endpoint: string, body: any): Promise<any>;
43
+ }
44
+
45
+ /**
46
+ * The base class for all structures.
47
+ */
48
+ declare abstract class Base {
49
+ readonly id: string;
50
+ cachedAt: number;
51
+ protected readonly client: Client;
52
+ constructor(client: Client, data: {
53
+ _id: string;
54
+ });
55
+ /**
56
+ * Compares this object with another to see if they represent the same entity.
57
+ */
58
+ equals(other: Base | string): boolean;
59
+ /**
60
+ * Returns the UUID string when the object is cast to a string.
61
+ */
62
+ toString(): string;
63
+ /**
64
+ * Helper to quickly clone a structure
65
+ */
66
+ _clone(): this;
67
+ }
68
+
69
+ type AttachmentMetadata = {
70
+ type: "File";
71
+ } | {
72
+ type: "Text";
73
+ } | {
74
+ type: "Audio";
75
+ } | {
76
+ type: "Image";
77
+ width: number;
78
+ height: number;
79
+ thumbhash?: number[];
80
+ animated?: boolean;
81
+ } | {
82
+ type: "Video";
83
+ width: number;
84
+ height: number;
85
+ };
86
+ declare class Attachment extends Base {
87
+ id: string;
88
+ tag: string;
89
+ filename: string;
90
+ metadata: AttachmentMetadata;
91
+ contentType: string;
92
+ size: number;
93
+ deleted?: boolean;
94
+ reported?: boolean;
95
+ messageId?: string;
96
+ userId?: string;
97
+ serverId?: string;
98
+ objectId?: string;
99
+ constructor(client: Client, data: any);
100
+ /**
101
+ * Automatically constructs the direct CDN URL for this file
102
+ */
103
+ get url(): string;
104
+ /**
105
+ * Helper boolean to quickly check if it's an image
106
+ */
107
+ get isImage(): boolean;
108
+ }
109
+
110
+ declare enum UserRelationship {
111
+ None = "None",
112
+ User = "User",
113
+ Friend = "Friend",
114
+ Outgoing = "Outgoing",
115
+ Incoming = "Incoming",
116
+ Blocked = "Blocked",
117
+ BlockedOther = "BlockedOther"
118
+ }
119
+ declare enum UserPresence {
120
+ Online = "Online",
121
+ Idle = "Idle",
122
+ Focus = "Focus",
123
+ Busy = "Busy",
124
+ Invisible = "Invisible"
125
+ }
126
+ interface BotInformation {
127
+ owner: string;
128
+ }
129
+ interface UserStatus {
130
+ presence: UserPresence;
131
+ text?: string | null;
132
+ }
133
+ interface UserProfile {
134
+ background?: string | null;
135
+ content?: string | null;
136
+ }
137
+ declare class User extends Base {
138
+ discriminator: string;
139
+ online: boolean;
140
+ relationship: UserRelationship;
141
+ username: string;
142
+ avatar?: Attachment | null;
143
+ badges?: number;
144
+ bot: false | BotInformation;
145
+ displayName?: string | null;
146
+ flags?: number;
147
+ privileged?: boolean;
148
+ status?: UserStatus | null;
149
+ constructor(client: Client, data: any);
150
+ _patch(data: any, clear?: string[]): void;
151
+ /**
152
+ * Convenience getter to return the user's tag (username#discriminator)
153
+ */
154
+ get tag(): string;
155
+ /**
156
+ * Fetch a User to update their information
157
+ * @param force Skip the cache check and force an API request
158
+ * @returns The fetched User object
159
+ * @throws Error if the user cannot be found or fetched
160
+ * @example
161
+ * // Fetch a user
162
+ * await user.fetch();
163
+ */
164
+ fetch(force?: boolean): Promise<this>;
165
+ }
166
+
167
+ /**
168
+ * A utility class that extends the native JavaScript Map with Array-like methods.
169
+ */
170
+ declare class Collection<K, V> extends Map<K, V> {
171
+ limit: number;
172
+ constructor(limit?: number);
173
+ /**
174
+ * Overrides the default set method to enforce the maximum cache size.
175
+ */
176
+ set(key: K, value: V): this;
177
+ /**
178
+ * Finds the first item where the given function returns true.
179
+ */
180
+ find(fn: (value: V, key: K, collection: this) => boolean): V | undefined;
181
+ /**
182
+ * Returns a new Collection containing only the items where the function returns true.
183
+ */
184
+ filter(fn: (value: V, key: K, collection: this) => boolean): Collection<K, V>;
185
+ /**
186
+ * Maps each item to a new array of values.
187
+ */
188
+ map<T>(fn: (value: V, key: K, collection: this) => T): T[];
189
+ /**
190
+ * Gets the very first value in the Collection (based on insertion order).
191
+ */
192
+ first(): V | undefined;
193
+ /**
194
+ * Gets the very last value in the Collection.
195
+ */
196
+ last(): V | undefined;
197
+ /**
198
+ * Checks if at least one item matches the condition.
199
+ */
200
+ some(fn: (value: V, key: K, collection: this) => boolean): boolean;
201
+ }
202
+
203
+ /**
204
+ * @template K The type of the cache keys (usually string)
205
+ * @template Holds The type of the Structure this manager holds
206
+ */
207
+ declare abstract class BaseManager<K, Holds> {
208
+ client: Client;
209
+ cache: Collection<K, Holds>;
210
+ constructor(client: Client, limit?: number);
211
+ /**
212
+ * Defines how to extract the unique ID from a raw API payload.
213
+ * @internal
214
+ */
215
+ protected abstract extractId(data: any): K;
216
+ /**
217
+ * Defines how to construct a new instance of the Structure.
218
+ * @internal
219
+ */
220
+ protected abstract construct(data: any): Holds;
221
+ /**
222
+ * Transforms raw data into a Structure, patches if existing, and saves to cache.
223
+ * @internal
224
+ */
225
+ _add(data: any): Holds;
226
+ }
227
+
228
+ type MemberResolvable = Member | User | string;
229
+ interface MemberEditOptions {
230
+ nickname?: string | null;
231
+ avatar?: string | null;
232
+ roles?: string[];
233
+ timeout?: string | null;
234
+ }
235
+ interface MemberBanOptions {
236
+ reason?: string | null;
237
+ deleteMessageSeconds?: number;
238
+ }
239
+ interface FetchMembersOptions {
240
+ exclude_offline?: boolean;
241
+ }
242
+ declare class MemberManager extends BaseManager<string, Member> {
243
+ server: Server;
244
+ constructor(client: Client, server: Server, limit?: number);
245
+ /**
246
+ * Tell BaseManager how to handle Revolt's Member IDs
247
+ * @internal
248
+ */
249
+ protected extractId(data: any): string;
250
+ /**
251
+ * Tell BaseManager how to build a Member
252
+ * @internal
253
+ */
254
+ protected construct(data: any): Member;
255
+ resolve(member: MemberResolvable): Member | undefined;
256
+ resolveId(member: MemberResolvable): string;
257
+ fetch(member: MemberResolvable, force?: boolean): Promise<Member>;
258
+ /**
259
+ * Fetches multiple members from the server.
260
+ * @param options Filter options for the fetch request.
261
+ * @returns A promise that resolves to a Collection of fetched Members.
262
+ * @throws {Error} If the API request fails.
263
+ * @example
264
+ * // Fetch all members in the server
265
+ * const allMembers = await server.members.fetchMany();
266
+ *
267
+ * // Fetch only online members to save bandwidth
268
+ * const onlineMembers = await server.members.fetchMany({ exclude_offline: true });
269
+ */
270
+ fetchMany(options?: FetchMembersOptions): Promise<Collection<string, Member>>;
271
+ /**
272
+ * Edits a member in the server.
273
+ * @param member The MemberResolvable to edit.
274
+ * @param options The fields to update (nickname, roles, timeout, etc.).
275
+ */
276
+ edit(member: MemberResolvable, options: MemberEditOptions): Promise<Member>;
277
+ /**
278
+ * Kicks a member from the server.
279
+ * @param member The MemberResolvable to kick.
280
+ */
281
+ kick(member: MemberResolvable): Promise<void>;
282
+ /**
283
+ * Bans a member from the server.
284
+ * @param member The MemberResolvable to ban.
285
+ * @param options The ban options
286
+ */
287
+ ban(member: MemberResolvable, options?: MemberBanOptions): Promise<void>;
288
+ /**
289
+ * Unbans a user from the server
290
+ * @param member The MemberResolvable to unban
291
+ */
292
+ unban(member: MemberResolvable): Promise<void>;
293
+ [util.inspect.custom](): Collection<string, Member>;
294
+ }
295
+
296
+ declare const PermissionFlags: {
297
+ readonly ManageChannel: bigint;
298
+ readonly ManageServer: bigint;
299
+ readonly ManagePermissions: bigint;
300
+ readonly ManageRole: bigint;
301
+ readonly ManageCustomisation: bigint;
302
+ readonly KickMembers: bigint;
303
+ readonly BanMembers: bigint;
304
+ readonly TimeoutMembers: bigint;
305
+ readonly AssignRoles: bigint;
306
+ readonly ChangeNickname: bigint;
307
+ readonly ManageNicknames: bigint;
308
+ readonly ChangeAvatar: bigint;
309
+ readonly RemoveAvatars: bigint;
310
+ readonly ViewChannel: bigint;
311
+ readonly ReadMessageHistory: bigint;
312
+ readonly SendMessage: bigint;
313
+ readonly ManageMessages: bigint;
314
+ readonly ManageWebhooks: bigint;
315
+ readonly InviteOthers: bigint;
316
+ readonly SendEmbeds: bigint;
317
+ readonly UploadFiles: bigint;
318
+ readonly Masquerade: bigint;
319
+ readonly React: bigint;
320
+ readonly BypassSlowmode: bigint;
321
+ readonly Connect: bigint;
322
+ readonly Speak: bigint;
323
+ readonly Video: bigint;
324
+ readonly MuteMembers: bigint;
325
+ readonly DeafenMembers: bigint;
326
+ readonly MoveMembers: bigint;
327
+ readonly Listen: bigint;
328
+ readonly MentionEveryone: bigint;
329
+ readonly MentionRoles: bigint;
330
+ readonly GrantAllSafe: 4503599627370495n;
331
+ };
332
+ type PermissionString = keyof typeof PermissionFlags;
333
+ type PermissionResolvable = bigint | PermissionString | PermissionResolvable[];
334
+ declare class Permissions {
335
+ /**
336
+ * Converts a string, BigInt, or array of strings into a single BigInt
337
+ */
338
+ static resolve(permission: PermissionResolvable): bigint;
339
+ /**
340
+ * Checks if a specific permission bit exists
341
+ */
342
+ static has(totalPermissions: bigint, permissionToCheck: PermissionResolvable): boolean;
343
+ }
344
+
345
+ declare class DMChannel extends BaseChannel {
346
+ active: boolean;
347
+ recipients: DMChannel[];
348
+ lastMessageId: string | null;
349
+ constructor(client: any, data: any);
350
+ _patch(data: any): void;
351
+ }
352
+
353
+ declare class GroupChannel extends BaseChannel {
354
+ name: string;
355
+ ownerId: string;
356
+ recipients: string[];
357
+ description?: string | null;
358
+ icon: Attachment | null;
359
+ lastMessageId?: string | null;
360
+ nsfw: boolean;
361
+ constructor(client: Client, data: any);
362
+ _patch(data: any, clear?: string[]): void;
363
+ /** Gets the User object of the person who owns this group */
364
+ get owner(): User | undefined;
365
+ /** Resolves the recipient IDs into an array of cached User objects */
366
+ get recipientUsers(): User[];
367
+ /**
368
+ * Updates the default (everyone) permissions for this channel.
369
+ * @param permissions The default permissions to grant globally in this channel.
370
+ * @returns A promise that resolves to the updated BaseChannel.
371
+ * @throws {TypeError} If invalid permissions are provided.
372
+ * @throws {Error} If the API request fails.
373
+ * @example
374
+ * // Set the default permission to allow everyone to view the channel
375
+ * await channel.setDefaultPermissions(["ViewChannel", "ReadMessageHistory"]);
376
+ */
377
+ setDefaultPermissions(permissions: PermissionResolvable): Promise<this>;
378
+ [util.inspect.custom](_depth: number, options: util.InspectOptions, inspect: typeof util.inspect): string;
379
+ }
380
+
381
+ type ChannelResolvable = BaseChannel | string;
382
+ interface ChannelEditOptions {
383
+ name?: string;
384
+ description?: string | null;
385
+ owner?: string;
386
+ icon?: string | null;
387
+ nsfw?: boolean;
388
+ archived?: boolean;
389
+ voice?: {
390
+ max_users: number;
391
+ };
392
+ slowmode?: number;
393
+ }
394
+ interface ChannelRolePermissionOptions {
395
+ allow?: PermissionResolvable;
396
+ deny?: PermissionResolvable;
397
+ }
398
+ declare class ChannelManager extends BaseManager<string, BaseChannel> {
399
+ client: Client;
400
+ /**
401
+ * Manages API methods and caching for all channels globally.
402
+ * @param client The active Client instance.
403
+ * @param limit The maximum number of channels to hold in the cache.
404
+ */
405
+ constructor(client: Client, limit?: number);
406
+ protected extractId(data: any): string;
407
+ protected construct(data: any): BaseChannel;
408
+ /**
409
+ * Resolves a ChannelResolvable to a cached BaseChannel object.
410
+ * @param channel The ChannelResolvable to resolve.
411
+ * @returns The resolved BaseChannel, or undefined if not cached.
412
+ */
413
+ resolve(channel: ChannelResolvable): BaseChannel | undefined;
414
+ resolveText(channel: ChannelResolvable): TextChannel | undefined;
415
+ resolveDM(channel: ChannelResolvable): DMChannel | undefined;
416
+ resolveGroup(channel: ChannelResolvable): GroupChannel | undefined;
417
+ /**
418
+ * Extracts ID from a ChannelResolvable.
419
+ * @param channel The ChannelResolvable to extract the ID from.
420
+ * @returns The extracted channel ID.
421
+ * @throws {TypeError} If an invalid type is provided.
422
+ */
423
+ resolveId(channel: ChannelResolvable): string;
424
+ /**
425
+ * Fetches a Channel from the API or resolves it from the local cache.
426
+ * @param channel The ID, mention, or Channel object to fetch.
427
+ * @param force Whether to skip the cache check and force a direct API request. Defaults to true.
428
+ * @returns A promise that resolves to the fetched BaseChannel object.
429
+ * @throws {TypeError} If an invalid ChannelResolvable is provided.
430
+ * @throws {Error} If the API request fails.
431
+ * @example
432
+ * // Fetch a channel, bypassing cache
433
+ * const channel = await client.channels.fetch("01H...");
434
+ */
435
+ fetch(channel: ChannelResolvable, force?: boolean): Promise<BaseChannel>;
436
+ /**
437
+ * Edits a channel in the server.
438
+ * @param channel The ChannelResolvable to edit.
439
+ * @param options The fields to update.
440
+ * @returns A promise that resolves to the updated BaseChannel.
441
+ * @throws {TypeError} If invalid options or ChannelResolvable are provided.
442
+ * @throws {Error} If the API request fails.
443
+ * @example
444
+ * // Update channel name and remove its description
445
+ * await client.channels.edit("01H...", { name: "general", description: null });
446
+ */
447
+ edit(channel: ChannelResolvable, options: ChannelEditOptions): Promise<BaseChannel>;
448
+ /**
449
+ * Updates the permission overrides for a specific role in a channel.
450
+ * @param channel The ChannelResolvable to update permissions for.
451
+ * @param roleId The raw string ID of the role to update.
452
+ * @param options The allow and deny permissions to set.
453
+ * @returns A promise that resolves to the updated BaseChannel.
454
+ * @throws {TypeError} If the channel is not a Server Channel, or options are invalid.
455
+ * @throws {Error} If the API request fails.
456
+ * @example
457
+ * // Deny a role the ability to send messages in this channel
458
+ * await client.channels.setRolePermissions(channel, "ROLE_ID", { deny: ["SendMessage"] });
459
+ */
460
+ setRolePermissions(channel: ChannelResolvable, roleId: string, options: ChannelRolePermissionOptions): Promise<BaseChannel>;
461
+ /**
462
+ * Updates the default (everyone) permissions for a channel.
463
+ * @param channel The ChannelResolvable to update permissions for.
464
+ * @param permissions The default permissions to grant globally in this channel.
465
+ * @returns A promise that resolves to the updated BaseChannel.
466
+ * @throws {TypeError} If invalid permissions are provided.
467
+ * @throws {Error} If the API request fails.
468
+ * @example
469
+ * // Set the default permission to allow everyone to view the channel
470
+ * await client.channels.setDefaultPermissions(channel, ["ViewChannel", "ReadMessageHistory"]);
471
+ */
472
+ setDefaultPermissions(channel: ChannelResolvable, permissions: PermissionResolvable): Promise<BaseChannel>;
473
+ /**
474
+ * Deletes a server channel, leaves a group, or closes a DM.
475
+ * @param channel The channel object, raw ID, or mention string to delete.
476
+ * @returns A promise that resolves when the action is successful.
477
+ * @throws {Error} If the API request fails.
478
+ * @example
479
+ * await client.channels.delete("01H...");
480
+ */
481
+ delete(channel: ChannelResolvable): Promise<void>;
482
+ }
483
+
484
+ declare class TextChannel extends BaseChannel {
485
+ name: string;
486
+ serverId: string;
487
+ defaultPermissions?: {
488
+ a: number;
489
+ d: number;
490
+ };
491
+ description?: string | null;
492
+ icon?: Attachment | null;
493
+ lastMessageId?: string | null;
494
+ nsfw?: boolean;
495
+ slowmode?: number;
496
+ voice?: any;
497
+ constructor(client: Client, data: any);
498
+ _patch(data: any, clear?: string[]): void;
499
+ /**
500
+ * Updates the permission overrides for the channel.
501
+ * @param roleId The raw string ID of the role to update.
502
+ * @param options The allow and deny permissions to set.
503
+ * @returns A promise that resolves to the updated BaseChannel.
504
+ * @throws {TypeError} If the channel is not a Server Channel, or options are invalid.
505
+ * @throws {Error} If the API request fails.
506
+ * @example
507
+ * // Deny a role the ability to send messages in this channel
508
+ * await channel.setRolePermissions("ROLE_ID", { deny: ["SendMessage"] });
509
+ */
510
+ setRolePermissions(roleId: string, options: ChannelRolePermissionOptions): Promise<this>;
511
+ /**
512
+ * Updates the default (everyone) permissions for this channel.
513
+ * @param permissions The default permissions to grant globally in this channel.
514
+ * @returns A promise that resolves to the updated BaseChannel.
515
+ * @throws {TypeError} If invalid permissions are provided.
516
+ * @throws {Error} If the API request fails.
517
+ * @example
518
+ * // Set the default permission to allow everyone to view the channel
519
+ * await channel.setDefaultPermissions(["ViewChannel", "ReadMessageHistory"]);
520
+ */
521
+ setDefaultPermissions(permissions: PermissionResolvable): Promise<this>;
522
+ }
523
+
524
+ type MessageResolvable = Message | string;
525
+ interface MessageFetchOptions {
526
+ limit?: number;
527
+ before?: string;
528
+ after?: string;
529
+ sort?: "Relevance" | "Latest" | "Oldest";
530
+ nearby?: string;
531
+ includeUsers?: boolean;
532
+ }
533
+ declare class MessageManager extends BaseManager<string, Message> {
534
+ private channel;
535
+ constructor(client: Client, channel: BaseChannel, limit?: number);
536
+ /**
537
+ * Tell BaseManager how to find the ID for Messages
538
+ */
539
+ protected extractId(data: any): string;
540
+ /**
541
+ * Tell BaseManager how to build a Message
542
+ */
543
+ protected construct(data: any): Message;
544
+ fetch(id: string): Promise<Message>;
545
+ /**
546
+ * Fetches multiple messages from the channel using specific filter parameters.
547
+ * @param options The query parameters to filter the fetched messages.
548
+ * @returns A promise that resolves to a Collection of fetched Messages.
549
+ * @throws {Error} If the API request fails.
550
+ * @example
551
+ * // Fetch the last 50 messages in the channel
552
+ * const messages = await channel.messages.fetchMany({ limit: 50, sort: "Latest" });
553
+ *
554
+ * // Fetch 20 messages before a specific message ID
555
+ * const history = await channel.messages.fetchMany({ limit: 20, before: "01H..." });
556
+ */
557
+ fetchMany(options?: MessageFetchOptions): Promise<Collection<string, Message>>;
558
+ resolveId(message: MessageResolvable): string;
559
+ /**
560
+ * Sends a new message to this channel.
561
+ * @param contentOrOptions The string content or message options payload.
562
+ * @returns A promise that resolves to the sent Message.
563
+ */
564
+ send(contentOrOptions: MessageOptions | string): Promise<Message>;
565
+ /**
566
+ * Edits an existing message.
567
+ * @param message The MessageResolvable (object or ID) to edit.
568
+ * @param contentOrOptions The new content or options.
569
+ * @returns A promise that resolves to the updated Message.
570
+ */
571
+ edit(message: MessageResolvable, contentOrOptions: string | MessageOptions): Promise<Message>;
572
+ /**
573
+ * Deletes a message from the channel.
574
+ * @param message The MessageResolvable to delete.
575
+ */
576
+ delete(message: MessageResolvable): Promise<void>;
577
+ /**
578
+ * Pins a message in the channel.
579
+ * @param message The MessageResolvable to pin.
580
+ */
581
+ pin(message: MessageResolvable): Promise<void>;
582
+ /**
583
+ * Unpins a message in the channel.
584
+ * @param message The MessageResolvable to unpin.
585
+ */
586
+ unpin(message: MessageResolvable): Promise<void>;
587
+ [util.inspect.custom](): Collection<string, Message>;
588
+ }
589
+
590
+ declare enum ChannelType {
591
+ TEXT = "TextChannel",
592
+ DM = "DirectMessage",
593
+ GROUP = "Group"
594
+ }
595
+ interface ChannelCreateOptions {
596
+ name: string;
597
+ type: "Text" | "Voice";
598
+ description?: string;
599
+ nsfw?: boolean;
600
+ voice?: {
601
+ max_users?: number;
602
+ };
603
+ }
604
+ declare abstract class BaseChannel extends Base {
605
+ type: ChannelType;
606
+ messages: MessageManager;
607
+ protected constructor(client: Client, data: any);
608
+ /**
609
+ * Sends a message to this channel.
610
+ * @param contentOrOptions The string content or message options payload.
611
+ * @returns A promise that resolves to the sent Message.
612
+ * @example
613
+ * await channel.send("Hello world!");
614
+ * await channel.send({ content: "Here is an embed", embeds: [myEmbed] });
615
+ */
616
+ send(contentOrOptions: string | MessageOptions): Promise<Message>;
617
+ fetch(force?: boolean): Promise<this>;
618
+ /**
619
+ * Fetches multiple messages from this channel.
620
+ * @param options The query parameters to filter the messages.
621
+ */
622
+ fetchMessages(options?: MessageFetchOptions): Promise<Collection<string, Message>>;
623
+ /**
624
+ * Edits this channel.
625
+ * @param options The fields to update
626
+ */
627
+ edit(options: ChannelEditOptions): Promise<this>;
628
+ /**
629
+ * Deletes this channel.
630
+ */
631
+ delete(): Promise<void>;
632
+ isText(): this is TextChannel;
633
+ isDM(): this is DMChannel;
634
+ isGroup(): this is GroupChannel;
635
+ }
636
+
637
+ declare class ServerChannelManager {
638
+ private client;
639
+ private server;
640
+ constructor(client: Client, server: Server);
641
+ get cache(): Collection<string, BaseChannel>;
642
+ /**
643
+ * Creates a new channel within this server.
644
+ * @param options The configuration for the new channel.
645
+ * @returns The newly created Channel object.
646
+ */
647
+ create(options: ChannelCreateOptions): Promise<BaseChannel>;
648
+ [util.inspect.custom](): Collection<string, BaseChannel>;
649
+ }
650
+
651
+ declare class Role extends Base {
652
+ serverId: string;
653
+ name: string;
654
+ color: string | null;
655
+ hoist: boolean;
656
+ rank: number;
657
+ permissions: bigint;
658
+ constructor(client: Client, data: any, serverId: string);
659
+ /**
660
+ * Updates the role instance with new data without losing the object reference.
661
+ * @internal
662
+ */
663
+ _patch(data: any): void;
664
+ /**
665
+ * The server this role belongs to.
666
+ * Pulls dynamically from the cache to prevent massive memory duplication.
667
+ */
668
+ get server(): Server | undefined;
669
+ /**
670
+ * Checks whether this role has a specific permission.
671
+ * @param permission The permission to check for.
672
+ * @returns True if the role has the permission.
673
+ */
674
+ hasPermission(permission: PermissionResolvable): boolean;
675
+ /**
676
+ * Fetches this role directly from the API to ensure data is up to date.
677
+ * @param force Whether to skip the cache check and force a direct API request. Defaults to false.
678
+ * @returns A promise that resolves to the fetched Role object.
679
+ * @throws {TypeError} If an invalid RoleResolvable is provided.
680
+ * @throws {Error} If the API request fails (e.g., the role does not exist).
681
+ * @example
682
+ * // Refresh the role's data from the API
683
+ * await role.fetch();
684
+ * console.log(`Role updated, current name: ${role.name}`);
685
+ */
686
+ fetch(force?: boolean): Promise<this>;
687
+ /**
688
+ * Edits the role with the given options. Only the fields provided in the options will be updated; all other fields will remain unchanged.
689
+ * @param options The fields to update.
690
+ * @returns A promise that resolves to the updated Role.
691
+ * @throws {TypeError} If invalid options or RoleResolvable are provided.
692
+ * @throws {Error} If the API request fails (e.g., lack of permissions).
693
+ * @example
694
+ * // Change the role's name and color
695
+ * await role.edit({ name: "Senior Admin", colour: "#FFD700" });
696
+ *
697
+ * // Remove the custom color from the role
698
+ * await role.edit({ colour: null });
699
+ */
700
+ edit(options: RoleEditOptions): Promise<this>;
701
+ /**
702
+ * Deletes this Role from the server.
703
+ * @throws {Error} If the role cannot be deleted (e.g., lack of permissions).
704
+ * @example
705
+ * // Delete a role by its ID
706
+ * await role.delete();
707
+ */
708
+ delete(): Promise<void>;
709
+ /**
710
+ * Updates the permissions for this role.
711
+ * @param options The allow and deny permissions to set.
712
+ * @returns A promise that resolves to the updated Role object.
713
+ * @throws {TypeError} If invalid options are provided.
714
+ * @throws {Error} If the API request fails.
715
+ * @example
716
+ * // Grant the role permission to manage channels and send messages
717
+ * await role.setPermissions({
718
+ * allow: ["ManageChannel", "SendMessage"]
719
+ * });
720
+ */
721
+ setPermissions(options: RolePermissionOptions): Promise<this>;
722
+ /**
723
+ * Updates the hierarchical position of this role.
724
+ * Automatically reconstructs the role array and performs a bulk update.
725
+ * @param newPosition The new rank/position for this role (0-indexed).
726
+ * @returns A promise that resolves to this updated Role object.
727
+ * @throws {Error} If API request fails.
728
+ * @example
729
+ * // Move this role to position 2 in the hierarchy
730
+ * await role.setPosition(2);
731
+ * console.log(`Role moved to rank: ${role.rank}`);
732
+ */
733
+ setPosition(newPosition: number): Promise<this>;
734
+ /**
735
+ * Customizer for Node.js `console.log` and `util.inspect`.
736
+ * Hides the cyclic client reference and raw serverId for a cleaner output.
737
+ * @internal
738
+ */
739
+ [util.inspect.custom](): string;
740
+ }
741
+
742
+ interface RoleCreateOptions {
743
+ name: string;
744
+ }
745
+ interface RoleEditOptions {
746
+ name?: string;
747
+ colour?: string | null;
748
+ hoist?: boolean;
749
+ }
750
+ interface RolePermissionOptions {
751
+ allow?: PermissionResolvable;
752
+ deny?: PermissionResolvable;
753
+ }
754
+ type RoleResolvable = Role | string;
755
+ declare class RoleManager extends BaseManager<string, Role> {
756
+ private server;
757
+ /**
758
+ * Manages API methods and caching for server roles.
759
+ */
760
+ constructor(client: Client, server: Server, limit?: number);
761
+ /**
762
+ * Tell BaseManager how to find the ID for Roles
763
+ */
764
+ protected extractId(data: any): string;
765
+ /**
766
+ * Tell BaseManager how to build a Role
767
+ */
768
+ protected construct(data: any): Role;
769
+ /**
770
+ * Adds or updates a role in the local cache.
771
+ * @internal
772
+ * @param data The raw role data from the API.
773
+ * @param idParam An optional ID parameter if the payload wraps the role object.
774
+ * @returns The newly created or updated Role object.
775
+ */
776
+ _add(data: any, idParam?: string): Role;
777
+ [util.inspect.custom](): Collection<string, Role>;
778
+ /**
779
+ * Resolves a RoleResolvable to a Role object from the cache.
780
+ * @param role The RoleResolvable to resolve.
781
+ * @returns The resolved Role object, or undefined if not found.
782
+ */
783
+ resolve(role: RoleResolvable): Role | undefined;
784
+ /**
785
+ * Extracts ID from a RoleResolvable.
786
+ * @param role The RoleResolvable to extract the ID from.
787
+ * @returns The extracted role ID.
788
+ * @throws TypeError if an invalid type is provided.
789
+ */
790
+ resolveId(role: RoleResolvable): string;
791
+ /**
792
+ * Creates a new role in this server.
793
+ * @param options The name and optional rank of the new role
794
+ * @returns Role The role that was created
795
+ * @throws {Error} If the role cannot be created (e.g., lack of permissions, invalid options).
796
+ * @throws {TypeError} If invalid options are provided.
797
+ * @example
798
+ * // Create a new role named "Moderator" with rank 1
799
+ * const moderatorRole = await server.roles.create({ name: "Moderator", rank: 1 });
800
+ * console.log(`Created role: ${moderatorRole.name} with ID: ${moderatorRole.id}`);
801
+ */
802
+ create(options: RoleCreateOptions): Promise<Role>;
803
+ /**
804
+ * Fetches a Role from the API or resolves it from the local cache.
805
+ * @param role The ID, mention, or Role object to fetch.
806
+ * @param force Whether to skip the cache check and force a direct API request. Defaults to false.
807
+ * @returns A promise that resolves to the fetched Role object.
808
+ * @throws {TypeError} If an invalid RoleResolvable is provided.
809
+ * @throws {Error} If the API request fails (e.g., the role does not exist).
810
+ * @example
811
+ * // Fetch a role from the API
812
+ * const role = await server.roles.fetch("01JE2MM759J5D7CHJF084R7MJ2");
813
+ * console.log(`Fetched role: ${role.name} with ID: ${role.id}`);
814
+ *
815
+ * // Fetch a role by mention
816
+ * const role = await.server.roles.fetch("<%01JE2MM759J5D7CHJF084R7MJ2>");
817
+ * console.log(`Fetched role: ${role.name} with ID: ${role.id}`);
818
+ *
819
+ * // Force fetch a role, bypassing the cache
820
+ * const role = await server.roles.fetch("01JE2MM759J5D7CHJF084R7MJ2", true);
821
+ * console.log(`Fetched role: ${role.name} with ID: ${role.id}`);
822
+ */
823
+ fetch(role: RoleResolvable, force?: boolean): Promise<Role>;
824
+ /**
825
+ * Edits an existing role in the server.
826
+ * @param role The RoleResolvable to edit.
827
+ * @param options The fields to update.
828
+ * @returns A promise that resolves to the updated Role.
829
+ * @throws {TypeError} If invalid options or RoleResolvable are provided.
830
+ * @throws {Error} If the API request fails (e.g., lack of permissions).
831
+ * @example
832
+ * // Rename a role and give it a red color
833
+ * await server.roles.edit("01H...", { name: "Super Admin", colour: "#FF0000" });
834
+ *
835
+ * // Remove the custom color from a role
836
+ * await server.roles.edit(role, { colour: null });
837
+ */
838
+ edit(role: RoleResolvable, options: RoleEditOptions): Promise<Role>;
839
+ /**
840
+ * Deletes a Role from the server.
841
+ * @param role The RoleResolvable to delete
842
+ * @returns A promise that resolves when the role is successfully deleted.
843
+ * @throws {TypeError} If an invalid RoleResolvable is provided.
844
+ * @throws {Error} If the role cannot be deleted (e.g., lack of permissions).
845
+ * @example
846
+ * // Delete a role by its ID
847
+ * await server.roles.delete("01JE2MM759J5D7CHJF084R7MJ2");
848
+ * console.log("Role deleted successfully.");
849
+ *
850
+ * // Delete a role using a Role object
851
+ * const role = await server.roles.fetch("01JE2MM759J5D7CHJF084R7MJ2");
852
+ * await server.roles.delete(role);
853
+ * console.log("Role deleted successfully.");
854
+ *
855
+ * // Delete a role by mention
856
+ * await server.roles.delete("<%01JE2MM759J5D7CHJF084R7MJ2>");
857
+ * console.log("Role deleted successfully.");
858
+ */
859
+ delete(role: RoleResolvable): Promise<void>;
860
+ /**
861
+ * Updates the permissions for a role in the server.
862
+ * @param role The RoleResolvable to update permissions for.
863
+ * @param options The allow and deny permissions to set.
864
+ * @returns A promise that resolves to the updated Role.
865
+ * @throws {TypeError} If an invalid RoleResolvable or options are provided.
866
+ * @throws {Error} If the API request fails.
867
+ * @example
868
+ * // Set permissions using an array of strings.
869
+ * await server.roles.setPermissions(role, {
870
+ * allow: ["ManageChannel", "ViewChannel", "SendMessage"]
871
+ * });
872
+ */
873
+ setPermissions(role: RoleResolvable, options: RolePermissionOptions): Promise<Role>;
874
+ /**
875
+ * Updates the hierarchical positions of roles in the server.
876
+ * @param ranks An array of RoleResolvables representing the new order of roles.
877
+ * @returns A promise that resolves when the ranks are successfully updated.
878
+ * @throws {TypeError} If the ranks parameter is not an array or contains invalid resolvables.
879
+ * @throws {Error} If the API request fails.
880
+ * @example
881
+ * // Reorder roles by passing an array of Role objects or IDs
882
+ * await server.roles.setRanks(["RoleID_1", adminRoleObject, "RoleID_3"]);
883
+ */
884
+ setRanks(ranks: RoleResolvable[]): Promise<Server>;
885
+ }
886
+
887
+ declare class ServerInvite {
888
+ code: string;
889
+ creatorId: string;
890
+ channelId: string;
891
+ constructor(data: any);
892
+ _patch(data: any): void;
893
+ }
894
+
895
+ declare class ServerInviteManager extends BaseManager<string, ServerInvite> {
896
+ server: Server;
897
+ constructor(client: Client, server: Server, limit?: number);
898
+ protected extractId(data: any): string;
899
+ protected construct(data: any): ServerInvite;
900
+ /**
901
+ * Fetches all active invites for this server.
902
+ */
903
+ fetch(): Promise<Collection<string, ServerInvite>>;
904
+ }
905
+
906
+ declare class ServerBan {
907
+ userId: string;
908
+ reason: string | null;
909
+ constructor(data: any);
910
+ _patch(data: any): void;
911
+ }
912
+
913
+ declare class ServerBanManager extends BaseManager<string, ServerBan> {
914
+ server: Server;
915
+ constructor(client: Client, server: Server, limit?: number);
916
+ protected extractId(data: any): string;
917
+ protected construct(data: any): ServerBan;
918
+ /**
919
+ * Fetches all bans in this server.
920
+ * Automatically caches the associated User objects globally!
921
+ * @returns A promise that resolves to a Collection of Bans.
922
+ */
923
+ fetch(): Promise<Collection<string, ServerBan>>;
924
+ /**
925
+ * Unbans a user from the server.
926
+ * @param userId The ID of the user to unban.
927
+ */
928
+ remove(userId: string): Promise<void>;
929
+ }
930
+
931
+ interface ServerEditOptions {
932
+ name?: string;
933
+ description?: string | null;
934
+ icon?: string | null;
935
+ banner?: string | null;
936
+ categories?: {
937
+ id: string;
938
+ title: string;
939
+ channels: string[];
940
+ }[];
941
+ systemMessages?: {
942
+ userJoined?: string | null;
943
+ userLeft?: string | null;
944
+ userKicked?: string | null;
945
+ userBanned?: string | null;
946
+ };
947
+ analytics?: boolean;
948
+ owner?: string;
949
+ }
950
+ declare class ServerManager extends BaseManager<string, Server> {
951
+ constructor(client: Client, limit?: number);
952
+ /**
953
+ * Tell BaseManager how to find the ID for Servers
954
+ */
955
+ protected extractId(data: any): string;
956
+ /**
957
+ * Tell BaseManager how to build a Server
958
+ */
959
+ protected construct(data: any): Server;
960
+ /**
961
+ * Fetches a server from the API.
962
+ * @param id The server ID.
963
+ * @param force Whether to skip the cache and fetch from the API.
964
+ */
965
+ fetch(id: string, force?: boolean): Promise<Server>;
966
+ edit(serverId: string, options: ServerEditOptions): Promise<Server>;
967
+ [util.inspect.custom](): Collection<string, Server>;
968
+ }
969
+
970
+ interface Categories {
971
+ channels: string[];
972
+ id: string;
973
+ title: string;
974
+ }
975
+ declare class Server extends Base {
976
+ channelIds: string[];
977
+ defaultPermissions: bigint;
978
+ name: string;
979
+ ownerId: string;
980
+ analytics: boolean;
981
+ banner: Attachment | null;
982
+ categories: Categories[];
983
+ description: string | null;
984
+ discoverable: boolean;
985
+ flags: number;
986
+ icon: Attachment | null;
987
+ nsfw: boolean;
988
+ members: MemberManager;
989
+ channels: ServerChannelManager;
990
+ roles: RoleManager;
991
+ bans: ServerBanManager;
992
+ invites: ServerInviteManager;
993
+ constructor(client: Client, data: any);
994
+ /**
995
+ * Updates the server instance with new data without losing the object reference.
996
+ */
997
+ _patch(data: any, clear?: string[]): void;
998
+ /**
999
+ * Edits this server.
1000
+ * @param options The fields to update.
1001
+ */
1002
+ edit(options: ServerEditOptions): Promise<this>;
1003
+ /**
1004
+ * Leaves the server
1005
+ */
1006
+ leave(): Promise<any>;
1007
+ /**
1008
+ * Fetches multiple members from this server.
1009
+ * @param options Filter options for the fetch request.
1010
+ * @returns A Collection of the fetched members.
1011
+ */
1012
+ fetchMembers(options?: FetchMembersOptions): Promise<Collection<string, Member>>;
1013
+ }
1014
+
1015
+ declare class MemberRoleManager {
1016
+ private member;
1017
+ constructor(member: Member);
1018
+ /**
1019
+ * Gets a Collection of the actual Role objects this member has.
1020
+ * This dynamically pulls from the Server's role cache so references are always up to date
1021
+ */
1022
+ get cache(): Collection<string, Role>;
1023
+ /**
1024
+ * Checks if the member has a specific role.
1025
+ * @param role The RoleResolvable to check for.
1026
+ */
1027
+ has(role: RoleResolvable): boolean;
1028
+ /**
1029
+ * Adds a role to the member.
1030
+ * @param role The RoleResolvable to add.
1031
+ * @returns A promise that resolves to the updated Member.
1032
+ */
1033
+ add(role: RoleResolvable): Promise<Member>;
1034
+ /**
1035
+ * Removes a role from the member.
1036
+ * @param role The RoleResolvable to remove.
1037
+ * @returns A promise that resolves to the updated Member.
1038
+ */
1039
+ remove(role: RoleResolvable): Promise<Member>;
1040
+ /**
1041
+ * Overwrites all roles on the member with a completely new array.
1042
+ * @param roles An array of RoleResolvables.
1043
+ * @returns A promise that resolves to the updated Member.
1044
+ */
1045
+ set(roles: RoleResolvable[]): Promise<Member>;
1046
+ }
1047
+
1048
+ declare class Member extends Base {
1049
+ serverId: string;
1050
+ nickname: string | null;
1051
+ avatar: string | null;
1052
+ roleIds: string[];
1053
+ joinedAt: Date;
1054
+ timeout: Date | null;
1055
+ canPublish: boolean;
1056
+ canRecieve: boolean;
1057
+ roles: MemberRoleManager;
1058
+ constructor(client: Client, data: any);
1059
+ _patch(data: any): void;
1060
+ /** Gets the global User object for this member */
1061
+ get user(): User | undefined;
1062
+ /** Gets the Server object this member belongs to */
1063
+ get server(): Server | undefined;
1064
+ /** Resolves the array of role strings into actual Role objects */
1065
+ get roleObjects(): Role[];
1066
+ /** Calculates the member's total permissions using BigInt */
1067
+ get permissions(): bigint;
1068
+ /** Checks if the member has a specific permission */
1069
+ hasPermission(permission: PermissionResolvable): boolean;
1070
+ /**
1071
+ * Edits this member's nickname, avatar, roles, or timeout.
1072
+ */
1073
+ edit(options: MemberEditOptions): Promise<this>;
1074
+ /**
1075
+ * Kicks this member from the server.
1076
+ */
1077
+ kick(): Promise<void>;
1078
+ /**
1079
+ * Bans this member from the server.
1080
+ * @param options The options for this ban
1081
+ */
1082
+ ban(options?: MemberBanOptions): Promise<void>;
1083
+ unban(): Promise<void>;
1084
+ [util.inspect.custom](depth: number, options: util.InspectOptions, inspect: typeof util.inspect): string;
1085
+ }
1086
+
1087
+ interface TextEmbedData {
1088
+ type: "Text";
1089
+ title?: string;
1090
+ description?: string;
1091
+ url?: string;
1092
+ icon_url?: string;
1093
+ colour?: string;
1094
+ media?: string;
1095
+ }
1096
+ declare class EmbedBuilder {
1097
+ private data;
1098
+ constructor(data?: Partial<TextEmbedData>);
1099
+ setTitle(title: string): this;
1100
+ setDescription(description: string): this;
1101
+ setUrl(url: string): this;
1102
+ setIconUrl(iconUrl: string): this;
1103
+ setColor(color: string): this;
1104
+ setMedia(fileId: string): this;
1105
+ /**
1106
+ * Serializes the builder into the raw JSON required by the API
1107
+ */
1108
+ toJSON(): TextEmbedData;
1109
+ }
1110
+
1111
+ interface MessageOptions {
1112
+ content?: string;
1113
+ embeds?: (TextEmbedData | EmbedBuilder)[];
1114
+ attachments?: string[];
1115
+ interactions?: any[];
1116
+ flags?: number;
1117
+ masquerade?: Masquerade;
1118
+ replies?: ReplyIntent[];
1119
+ }
1120
+ interface Masquerade {
1121
+ avatar?: string;
1122
+ name?: string;
1123
+ colour?: string;
1124
+ }
1125
+ interface ReplyIntent {
1126
+ id: string;
1127
+ mention: boolean;
1128
+ fail_if_not_exists?: boolean;
1129
+ }
1130
+ interface Interaction {
1131
+ reactions: string[];
1132
+ restrictReactions: boolean;
1133
+ }
1134
+ declare class Message extends Base {
1135
+ content: string | null;
1136
+ authorId: string;
1137
+ channelId: string;
1138
+ embeds: any[];
1139
+ attachments: Attachment[];
1140
+ editedAt: Date | null;
1141
+ createdAt: Date | null;
1142
+ flags: number;
1143
+ interactions: Interaction | null;
1144
+ masquerade: Masquerade | null;
1145
+ mentions: string[];
1146
+ pinned: boolean;
1147
+ reactions: any[];
1148
+ replies: string[];
1149
+ role_mentions: string[];
1150
+ constructor(client: Client, data: any);
1151
+ reply(contentOrOptions: string | MessageOptions): Promise<Message>;
1152
+ /**
1153
+ * Edits this message.
1154
+ * @param contentOrOptions The new content or options for the message.
1155
+ */
1156
+ edit(contentOrOptions: string | MessageOptions): Promise<this>;
1157
+ /**
1158
+ * Deletes this message.
1159
+ */
1160
+ delete(): Promise<void>;
1161
+ /**
1162
+ * Pins this message.
1163
+ */
1164
+ pin(): Promise<void>;
1165
+ /**
1166
+ * Unpins this message.
1167
+ */
1168
+ unpin(): Promise<void>;
1169
+ /** Gets the Channel object from cache */
1170
+ get channel(): BaseChannel | undefined;
1171
+ /** Gets the Global User object from cache */
1172
+ get author(): User | undefined;
1173
+ /** Gets the Server Member object (if sent in a server) */
1174
+ get member(): Member | undefined;
1175
+ /** Gets the Server ID if this message was sent in a server channel */
1176
+ get serverId(): string | undefined;
1177
+ /** Gets the Server object from cache */
1178
+ get server(): Server | undefined;
1179
+ _patch(data: any): void;
1180
+ [util.inspect.custom](depth: number, options: util.InspectOptions, inspect: typeof util.inspect): string;
1181
+ }
1182
+
1183
+ type UserResolvable = User | string;
1184
+ interface UserEditOptions {
1185
+ avatar?: string | null;
1186
+ displayName?: string | null;
1187
+ profile?: UserProfile;
1188
+ status?: UserStatus;
1189
+ }
1190
+ declare class UserManager extends BaseManager<string, User> {
1191
+ constructor(client: Client, limit?: number);
1192
+ /**
1193
+ * Tell BaseManager how to find the ID for Users
1194
+ */
1195
+ protected extractId(data: any): string;
1196
+ /**
1197
+ * Tell BaseManager how to build a User
1198
+ */
1199
+ protected construct(data: any): User;
1200
+ /**
1201
+ * Resolves a UserResolvable to a User object from the cache.
1202
+ */
1203
+ resolve(user: UserResolvable): User | undefined;
1204
+ /**
1205
+ * Extracts ID from a UserResolvable.
1206
+ * @param user The UserResolvable to extract the ID from.
1207
+ * @returns The extracted user ID.
1208
+ * @throws TypeError if an invalid type is provided.
1209
+ */
1210
+ resolveId(user: UserResolvable): string;
1211
+ /**
1212
+ * Fetches a User.
1213
+ * @param user The ID or mention to fetch
1214
+ * @param force Skip the cache check and force an API request
1215
+ * @returns The fetched User object
1216
+ * @throws Error if the user cannot be found or fetched
1217
+ * @throws TypeError if invalid UserResolvable is provided
1218
+ * @example
1219
+ * // Fetch a user by ID
1220
+ * const user = await client.users.fetch("01JE2MM759J5D7CHJF084R7MJ2");
1221
+ * console.log(user.username);
1222
+ *
1223
+ * // Fetch a user by mention
1224
+ * const user = await client.users.fetch("<@01JE2MM759J5D7CHJF084R7MJ2>");
1225
+ * console.log(user.username);
1226
+ *
1227
+ * // Force fetch a user, bypassing the cache
1228
+ * const user = await client.users.fetch("01JE2MM759J5D7CHJF084R7MJ2", true);
1229
+ * console.log(user.username);
1230
+ */
1231
+ fetch(user: UserResolvable, force?: boolean): Promise<User>;
1232
+ /**
1233
+ * Fetch the current user (the bot itself).
1234
+ * @returns The fetched User object representing the current user.
1235
+ * @throws Error if the user cannot be fetched.
1236
+ * @example
1237
+ * // Fetch the current user (the bot itself)
1238
+ * const me = await client.users.fetchMe();
1239
+ * console.log(`Logged in as ${me.tag}`);
1240
+ */
1241
+ fetchMe(): Promise<User>;
1242
+ /**
1243
+ * Edits the currently authenticated user (the bot itself).
1244
+ * @param options The fields to update (avatar, status, profile, etc.).
1245
+ * @returns A promise that resolves to the updated User object.
1246
+ * @throws {TypeError} If invalid options are provided.
1247
+ * @throws {Error} If the API request fails.
1248
+ * @example
1249
+ * // Update the bot's status and presence
1250
+ * await client.users.editMe({
1251
+ * status: { text: "Watching the server", presence: "Online" }
1252
+ * });
1253
+ *
1254
+ * // Clear the bot's avatar and display name
1255
+ * await client.users.editMe({ avatar: null, displayName: null });
1256
+ */
1257
+ editMe(options: UserEditOptions): Promise<User>;
1258
+ }
1259
+
1260
+ /**
1261
+ * Represents the authenticated bot's user object.
1262
+ */
1263
+ declare class ClientUser extends User {
1264
+ constructor(client: Client, data: any);
1265
+ }
1266
+
1267
+ interface SweeperOptions {
1268
+ messages?: {
1269
+ lifetime: number;
1270
+ interval: number;
1271
+ };
1272
+ }
1273
+ declare class SweeperManager {
1274
+ private client;
1275
+ private options;
1276
+ private messageInterval;
1277
+ constructor(client: Client, options: SweeperOptions);
1278
+ start(): void;
1279
+ private sweepMessages;
1280
+ stop(): void;
1281
+ }
1282
+
1283
+ interface ClientEvents {
1284
+ ready: [data: any];
1285
+ messageCreate: [message: Message];
1286
+ messageUpdate: [oldMessage: null | Message, newMessage: Message];
1287
+ messageDelete: [message: Message | {
1288
+ id: string;
1289
+ channelId: string;
1290
+ }];
1291
+ error: [error: Error];
1292
+ debug: [message: string];
1293
+ raw: [data: any];
1294
+ channelCreate: [channel: BaseChannel];
1295
+ channelUpdate: [oldChannel: BaseChannel | null, newChannel: BaseChannel];
1296
+ channelDelete: [channel: BaseChannel | string];
1297
+ serverCreate: [server: Server];
1298
+ serverUpdate: [oldServer: Server | null, newServer: Server];
1299
+ serverDelete: [server: Server | string];
1300
+ userUpdate: [oldUser: User, newUser: User];
1301
+ serverMemberJoin: [member: Member];
1302
+ serverMemberLeave: [member: Member];
1303
+ }
1304
+ interface ClientOptions {
1305
+ sweepers?: SweeperOptions;
1306
+ cacheLimits?: {
1307
+ users?: number;
1308
+ servers?: number;
1309
+ channels?: number;
1310
+ };
1311
+ }
1312
+ declare class Client extends EventEmitter {
1313
+ options: ClientOptions;
1314
+ rest: RESTManager;
1315
+ gateway: GatewayManager;
1316
+ channels: ChannelManager;
1317
+ servers: ServerManager;
1318
+ users: UserManager;
1319
+ sweepers: SweeperManager;
1320
+ user: ClientUser | null;
1321
+ constructor(options?: ClientOptions);
1322
+ /**
1323
+ * Connects the bot to the Stoat Gateway
1324
+ */
1325
+ login(token: string): Promise<any>;
1326
+ on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
1327
+ once<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
1328
+ emit<K extends keyof ClientEvents>(event: K, ...args: ClientEvents[K]): boolean;
1329
+ }
1330
+
1331
+ /**
1332
+ * A fallback class for channel types that are not yet officially supported by the library.
1333
+ */
1334
+ declare class UnknownChannel extends BaseChannel {
1335
+ constructor(client: Client, data: any);
1336
+ }
1337
+
1338
+ export { Attachment, type AttachmentMetadata, Base, BaseChannel, type BotInformation, type Categories, type ChannelCreateOptions, type ChannelEditOptions, ChannelManager, type ChannelResolvable, type ChannelRolePermissionOptions, ChannelType, Client, type ClientEvents, type ClientOptions, ClientUser, Collection, DMChannel, EmbedBuilder, type FetchMembersOptions, GatewayManager, type Interaction, type Masquerade, Member, type MemberBanOptions, type MemberEditOptions, MemberManager, type MemberResolvable, Message, type MessageFetchOptions, MessageManager, type MessageOptions, type MessageResolvable, PermissionFlags, type PermissionResolvable, type PermissionString, Permissions, RESTManager, type ReplyIntent, Role, type RoleCreateOptions, type RoleEditOptions, RoleManager, type RolePermissionOptions, type RoleResolvable, Server, ServerChannelManager, type ServerEditOptions, ServerManager, SweeperManager, type SweeperOptions, TextChannel, type TextEmbedData, UnknownChannel, User, type UserEditOptions, UserManager, UserPresence, type UserProfile, UserRelationship, type UserResolvable, type UserStatus };