revbot.js 0.2.5 → 0.2.6
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.mts +814 -361
- package/dist/index.d.ts +814 -361
- package/dist/index.js +578 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +579 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { User as User$1, FieldsUser, SystemMessage, File, Masquerade, Message, Server as Server$1, FieldsServer,
|
|
2
|
-
import { File as File$1 } from 'node:buffer';
|
|
1
|
+
import { Role as Role$1, User as User$1, FieldsUser, SystemMessage, File as File$1, Masquerade, Message, Server as Server$1, FieldsServer, FieldsRole, Channel as Channel$1, MessageSort, Invite as Invite$1, Embed as Embed$1, SendableEmbed, Special, FieldsChannel, Member, FieldsMember, Category as Category$1 } from 'revolt-api';
|
|
3
2
|
import { Readable } from 'stream';
|
|
3
|
+
import { File as File$2 } from 'node:buffer';
|
|
4
4
|
import { EventEmitter } from 'node:events';
|
|
5
5
|
import FormData from 'form-data';
|
|
6
6
|
|
|
@@ -203,6 +203,243 @@ declare class CDNClient {
|
|
|
203
203
|
post<T>(url: string, data: FormData): Promise<T>;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
type ChannelPermissionsString = keyof typeof ChannelPermissions.FLAGS;
|
|
207
|
+
type UserPermissionsString = keyof typeof UserPermissions.FLAGS;
|
|
208
|
+
type ServerPermissionsString = keyof typeof ServerPermissions.FLAGS;
|
|
209
|
+
type ChannelPermissionsResolvable = number | ChannelPermissionsString | ChannelPermissions | ChannelPermissionsResolvable[];
|
|
210
|
+
type UserPermissionsResolvable = number | UserPermissionsString | UserPermissions | UserPermissionsResolvable[];
|
|
211
|
+
type ServerPermissionsResolvable = number | ServerPermissionsString | ServerPermissions | ServerPermissionsResolvable[];
|
|
212
|
+
declare interface ChannelPermissions {
|
|
213
|
+
serialize(): Record<ChannelPermissionsString, boolean>;
|
|
214
|
+
any(bit: ChannelPermissionsResolvable): boolean;
|
|
215
|
+
add(...bits: ChannelPermissionsResolvable[]): this;
|
|
216
|
+
remove(...bits: ChannelPermissionsResolvable[]): this;
|
|
217
|
+
has(bit: ChannelPermissionsResolvable): boolean;
|
|
218
|
+
}
|
|
219
|
+
declare class ChannelPermissions extends BitField {
|
|
220
|
+
static readonly FLAGS: {
|
|
221
|
+
readonly VIEW_CHANNEL: number;
|
|
222
|
+
readonly SEND_MESSAGE: number;
|
|
223
|
+
readonly MANAGE_MESSAGE: number;
|
|
224
|
+
readonly MANAGE_CHANNEL: number;
|
|
225
|
+
readonly VOICE_CALL: number;
|
|
226
|
+
readonly INVITE_OTHERS: number;
|
|
227
|
+
readonly EMBED_LINKS: number;
|
|
228
|
+
readonly UPLOAD_FILES: number;
|
|
229
|
+
};
|
|
230
|
+
constructor(bits?: ChannelPermissionsResolvable);
|
|
231
|
+
static resolve(bit: ChannelPermissionsResolvable): number;
|
|
232
|
+
}
|
|
233
|
+
declare interface UserPermissions {
|
|
234
|
+
serialize(): Record<UserPermissionsString, boolean>;
|
|
235
|
+
any(bit: UserPermissionsResolvable): boolean;
|
|
236
|
+
add(...bits: UserPermissionsResolvable[]): this;
|
|
237
|
+
remove(...bits: UserPermissionsResolvable[]): this;
|
|
238
|
+
has(bit: UserPermissionsResolvable): boolean;
|
|
239
|
+
}
|
|
240
|
+
declare class UserPermissions extends BitField {
|
|
241
|
+
static readonly FLAGS: {
|
|
242
|
+
readonly ACCESS: number;
|
|
243
|
+
readonly VIEW_PROFILE: number;
|
|
244
|
+
readonly SEND_MESSAGES: number;
|
|
245
|
+
readonly INVITE: number;
|
|
246
|
+
};
|
|
247
|
+
constructor(bits?: UserPermissionsResolvable);
|
|
248
|
+
static resolve(bit: UserPermissionsResolvable): number;
|
|
249
|
+
}
|
|
250
|
+
declare interface ServerPermissions {
|
|
251
|
+
serialize(): Record<ServerPermissionsString, boolean>;
|
|
252
|
+
any(bit: ServerPermissionsResolvable): boolean;
|
|
253
|
+
add(...bits: ServerPermissionsResolvable[]): this;
|
|
254
|
+
remove(...bits: ServerPermissionsResolvable[]): this;
|
|
255
|
+
has(bit: ServerPermissionsResolvable): boolean;
|
|
256
|
+
}
|
|
257
|
+
declare class ServerPermissions extends BitField {
|
|
258
|
+
static readonly FLAGS: {
|
|
259
|
+
readonly VIEW_SERVER: number;
|
|
260
|
+
readonly MANAGE_ROLES: number;
|
|
261
|
+
readonly MANAGE_CHANNELS: number;
|
|
262
|
+
readonly MANAGE_SERVER: number;
|
|
263
|
+
readonly KICK_MEMBERS: number;
|
|
264
|
+
readonly BAN_MEMBERS: number;
|
|
265
|
+
readonly CHANGE_NICKNAME: number;
|
|
266
|
+
readonly MANAGE_NICKNAMES: number;
|
|
267
|
+
readonly CHANGE_AVATAR: number;
|
|
268
|
+
readonly REMOVE_AVATARS: number;
|
|
269
|
+
};
|
|
270
|
+
constructor(bits?: ServerPermissionsResolvable);
|
|
271
|
+
static resolve(bit: ServerPermissionsResolvable): number;
|
|
272
|
+
}
|
|
273
|
+
declare class FullPermissions extends BitField {
|
|
274
|
+
static readonly FLAGS: {
|
|
275
|
+
readonly ManageChannel: number;
|
|
276
|
+
readonly ManageServer: number;
|
|
277
|
+
readonly ManagePermissions: number;
|
|
278
|
+
readonly ManageRole: number;
|
|
279
|
+
readonly ManageCustomisation: number;
|
|
280
|
+
readonly KickMembers: number;
|
|
281
|
+
readonly BanMembers: number;
|
|
282
|
+
readonly TimeoutMembers: number;
|
|
283
|
+
readonly AssignRoles: number;
|
|
284
|
+
readonly ChangeNickname: number;
|
|
285
|
+
readonly ManageNicknames: number;
|
|
286
|
+
readonly ChangeAvatar: number;
|
|
287
|
+
readonly RemoveAvatars: number;
|
|
288
|
+
readonly ViewChannel: number;
|
|
289
|
+
readonly ReadMessageHistory: number;
|
|
290
|
+
readonly SendMessage: number;
|
|
291
|
+
readonly ManageMessages: number;
|
|
292
|
+
readonly ManageWebhooks: number;
|
|
293
|
+
readonly InviteOthers: number;
|
|
294
|
+
readonly SendEmbeds: number;
|
|
295
|
+
readonly UploadFiles: number;
|
|
296
|
+
readonly Masquerade: number;
|
|
297
|
+
readonly React: number;
|
|
298
|
+
readonly Connect: number;
|
|
299
|
+
readonly Speak: number;
|
|
300
|
+
readonly Video: number;
|
|
301
|
+
readonly MuteMembers: number;
|
|
302
|
+
readonly DeafenMembers: number;
|
|
303
|
+
readonly MoveMembers: number;
|
|
304
|
+
readonly MentionEveryone: number;
|
|
305
|
+
readonly MentionRoles: number;
|
|
306
|
+
readonly GrantAll: 4503599627370495;
|
|
307
|
+
};
|
|
308
|
+
constructor(bits?: number | string | FullPermissions | Array<number | string | FullPermissions>);
|
|
309
|
+
static resolve(bit: number | string | FullPermissions): number;
|
|
310
|
+
}
|
|
311
|
+
declare const DEFAULT_PERMISSION_DM: Readonly<ChannelPermissions>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Represents a webhook avatar attachment.
|
|
315
|
+
*/
|
|
316
|
+
interface WebhookAvatar {
|
|
317
|
+
/** The unique identifier of the attachment. */
|
|
318
|
+
_id: string;
|
|
319
|
+
/** The tag associated with the attachment. */
|
|
320
|
+
tag: string;
|
|
321
|
+
/** The filename of the attachment. */
|
|
322
|
+
filename: string;
|
|
323
|
+
/** Additional metadata for the attachment. */
|
|
324
|
+
metadata: any;
|
|
325
|
+
/** The MIME type of the attachment. */
|
|
326
|
+
content_type: string;
|
|
327
|
+
/** The size of the attachment in bytes. */
|
|
328
|
+
size: number;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Represents data for a webhook creation event.
|
|
332
|
+
*/
|
|
333
|
+
interface WebhookCreateData {
|
|
334
|
+
/** The unique identifier of the webhook. */
|
|
335
|
+
webhookId: string;
|
|
336
|
+
/** The ID of the channel the webhook belongs to. */
|
|
337
|
+
channelId: string;
|
|
338
|
+
/** The name of the webhook. */
|
|
339
|
+
name: string;
|
|
340
|
+
/** The ID of the user who created the webhook. */
|
|
341
|
+
creatorId: string;
|
|
342
|
+
/** The webhook's token. */
|
|
343
|
+
token: string;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Represents data for a webhook deletion event.
|
|
347
|
+
*/
|
|
348
|
+
interface WebhookDeleteData {
|
|
349
|
+
/** The unique identifier of the webhook. */
|
|
350
|
+
webhookId: string;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Represents data for a webhook update event.
|
|
354
|
+
*/
|
|
355
|
+
interface WebhookUpdateData {
|
|
356
|
+
/** The unique identifier of the webhook. */
|
|
357
|
+
webhookId: string;
|
|
358
|
+
/** The updated name of the webhook. */
|
|
359
|
+
name: string;
|
|
360
|
+
/** The updated avatar of the webhook, if any. */
|
|
361
|
+
avatar: WebhookAvatar | undefined;
|
|
362
|
+
/** Fields to remove from the webhook. */
|
|
363
|
+
remove: string[];
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Represents the permissions that can be set for a role.
|
|
367
|
+
*/
|
|
368
|
+
type editablePermissions = {
|
|
369
|
+
/**
|
|
370
|
+
* Permissions to allow for the role.
|
|
371
|
+
* Each key corresponds to a permission flag in FullPermissions.
|
|
372
|
+
*/
|
|
373
|
+
a?: Array<keyof (typeof FullPermissions)["FLAGS"]>;
|
|
374
|
+
/**
|
|
375
|
+
* Permissions to deny for the role.
|
|
376
|
+
* Each key corresponds to a permission flag in FullPermissions.
|
|
377
|
+
*/
|
|
378
|
+
d?: Array<keyof (typeof FullPermissions)["FLAGS"]>;
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* Represents a role that can be edited in a server.
|
|
382
|
+
*/
|
|
383
|
+
type editableRole = {
|
|
384
|
+
/**
|
|
385
|
+
* Name of the role.
|
|
386
|
+
*/
|
|
387
|
+
name?: string;
|
|
388
|
+
/**
|
|
389
|
+
* Colour of the role, or `null` if no colour is set.
|
|
390
|
+
*/
|
|
391
|
+
colour?: string | null;
|
|
392
|
+
/**
|
|
393
|
+
* Whether the role is displayed separately in the member list.
|
|
394
|
+
*/
|
|
395
|
+
hoist?: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Rank of the role, used for ordering.
|
|
398
|
+
*/
|
|
399
|
+
rank?: number;
|
|
400
|
+
/**
|
|
401
|
+
* Permissions to set for the role.
|
|
402
|
+
* Format: { a: allow, d: deny }
|
|
403
|
+
*/
|
|
404
|
+
permissions?: editablePermissions;
|
|
405
|
+
/**
|
|
406
|
+
* Fields to remove from the role.
|
|
407
|
+
* Each key corresponds to a field in the Role type.
|
|
408
|
+
*/
|
|
409
|
+
remove?: Array<keyof Role$1 & {
|
|
410
|
+
[key: string]: unknown;
|
|
411
|
+
}>;
|
|
412
|
+
};
|
|
413
|
+
interface createWebhookResponse {
|
|
414
|
+
id: "string";
|
|
415
|
+
name: "string";
|
|
416
|
+
avatar: {
|
|
417
|
+
_id: "string";
|
|
418
|
+
tag: "string";
|
|
419
|
+
filename: "string";
|
|
420
|
+
metadata: {
|
|
421
|
+
type: "File";
|
|
422
|
+
};
|
|
423
|
+
content_type: "string";
|
|
424
|
+
size: 1;
|
|
425
|
+
deleted: null;
|
|
426
|
+
reported: null;
|
|
427
|
+
message_id: null;
|
|
428
|
+
user_id: null;
|
|
429
|
+
server_id: null;
|
|
430
|
+
object_id: null;
|
|
431
|
+
};
|
|
432
|
+
creator_id: "string";
|
|
433
|
+
channel_id: "string";
|
|
434
|
+
permissions: 0;
|
|
435
|
+
token: null;
|
|
436
|
+
}
|
|
437
|
+
interface editWebhookOptions {
|
|
438
|
+
name: string;
|
|
439
|
+
avatar?: Readable | string | File;
|
|
440
|
+
remove?: [];
|
|
441
|
+
}
|
|
442
|
+
|
|
206
443
|
/**
|
|
207
444
|
* Represents the events that the client can emit.
|
|
208
445
|
*/
|
|
@@ -261,6 +498,12 @@ interface ClientEvents {
|
|
|
261
498
|
[Events.ROLE_DELETE]: [Role];
|
|
262
499
|
/** emitted when a role is updated */
|
|
263
500
|
[Events.ROLE_UPDATE]: [Role, Role];
|
|
501
|
+
/** emitted when a webhook is created */
|
|
502
|
+
[Events.WEBHOOKS_CREATE]: [WebhookCreateData];
|
|
503
|
+
/** emitted when a webhook is deleted */
|
|
504
|
+
[Events.WEBHOOKS_DELETE]: [WebhookDeleteData];
|
|
505
|
+
/** emitted when a webhook is updated */
|
|
506
|
+
[Events.WEBHOOKS_UPDATE]: [WebhookUpdateData];
|
|
264
507
|
}
|
|
265
508
|
/**
|
|
266
509
|
* Represents the options for configuring the client.
|
|
@@ -388,7 +631,10 @@ declare enum Events {
|
|
|
388
631
|
SERVER_UPDATE = "serverUpdate",
|
|
389
632
|
TYPING_START = "typingStart",
|
|
390
633
|
TYPING_STOP = "typingStop",
|
|
391
|
-
USER_UPDATE = "userUpdate"
|
|
634
|
+
USER_UPDATE = "userUpdate",
|
|
635
|
+
WEBHOOKS_CREATE = "webhookCreate",
|
|
636
|
+
WEBHOOKS_DELETE = "webhookDelete",
|
|
637
|
+
WEBHOOKS_UPDATE = "webhookUpdate"
|
|
392
638
|
}
|
|
393
639
|
/**
|
|
394
640
|
* Enum representing the WebSocket events used for communication.
|
|
@@ -424,7 +670,10 @@ declare enum WSEvents {
|
|
|
424
670
|
SERVER_ROLE_UPDATE = "ServerRoleUpdate",
|
|
425
671
|
SERVER_UPDATE = "ServerUpdate",
|
|
426
672
|
USER_RELATIONSHIP = "UserRelationship",
|
|
427
|
-
USER_UPDATE = "UserUpdate"
|
|
673
|
+
USER_UPDATE = "UserUpdate",
|
|
674
|
+
WEBHOOKS_CREATE = "WebhooksCreate",
|
|
675
|
+
WEBHOOKS_DELETE = "WebhooksDelete",
|
|
676
|
+
WEBHOOKS_UPDATE = "WebhooksUpdate"
|
|
428
677
|
}
|
|
429
678
|
/**
|
|
430
679
|
* Enum representing the types of channels supported by the client.
|
|
@@ -445,133 +694,26 @@ declare const apiUrl = "https://api.stoat.chat";
|
|
|
445
694
|
/** The system user ID used for identifying system messages. */
|
|
446
695
|
declare const SYSTEM_USER_ID: string;
|
|
447
696
|
|
|
448
|
-
type
|
|
449
|
-
type
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
any(bit: ChannelPermissionsResolvable): boolean;
|
|
457
|
-
add(...bits: ChannelPermissionsResolvable[]): this;
|
|
458
|
-
remove(...bits: ChannelPermissionsResolvable[]): this;
|
|
459
|
-
has(bit: ChannelPermissionsResolvable): boolean;
|
|
460
|
-
}
|
|
461
|
-
declare class ChannelPermissions extends BitField {
|
|
462
|
-
static readonly FLAGS: {
|
|
463
|
-
readonly VIEW_CHANNEL: number;
|
|
464
|
-
readonly SEND_MESSAGE: number;
|
|
465
|
-
readonly MANAGE_MESSAGE: number;
|
|
466
|
-
readonly MANAGE_CHANNEL: number;
|
|
467
|
-
readonly VOICE_CALL: number;
|
|
468
|
-
readonly INVITE_OTHERS: number;
|
|
469
|
-
readonly EMBED_LINKS: number;
|
|
470
|
-
readonly UPLOAD_FILES: number;
|
|
471
|
-
};
|
|
472
|
-
constructor(bits?: ChannelPermissionsResolvable);
|
|
473
|
-
static resolve(bit: ChannelPermissionsResolvable): number;
|
|
474
|
-
}
|
|
475
|
-
declare interface UserPermissions {
|
|
476
|
-
serialize(): Record<UserPermissionsString, boolean>;
|
|
477
|
-
any(bit: UserPermissionsResolvable): boolean;
|
|
478
|
-
add(...bits: UserPermissionsResolvable[]): this;
|
|
479
|
-
remove(...bits: UserPermissionsResolvable[]): this;
|
|
480
|
-
has(bit: UserPermissionsResolvable): boolean;
|
|
697
|
+
type BadgeString = keyof typeof Badges.FLAGS;
|
|
698
|
+
type BadgesResolvable = number | BadgeString | Badges | BadgesResolvable[];
|
|
699
|
+
declare interface Badges {
|
|
700
|
+
serialize(): Record<BadgeString, boolean>;
|
|
701
|
+
any(bit: BadgesResolvable): boolean;
|
|
702
|
+
add(...bits: BadgesResolvable[]): this;
|
|
703
|
+
remove(...bits: BadgesResolvable[]): this;
|
|
704
|
+
has(bit: BadgesResolvable): boolean;
|
|
481
705
|
}
|
|
482
|
-
declare class
|
|
706
|
+
declare class Badges extends BitField {
|
|
483
707
|
static readonly FLAGS: {
|
|
484
|
-
readonly
|
|
485
|
-
readonly
|
|
486
|
-
readonly
|
|
487
|
-
readonly
|
|
708
|
+
readonly DEVELOPER: number;
|
|
709
|
+
readonly TRANSLATOR: number;
|
|
710
|
+
readonly SUPPORTER: number;
|
|
711
|
+
readonly RESPONSIBLE_DISCLOSURE: number;
|
|
712
|
+
readonly REVOLT_TEAM: number;
|
|
713
|
+
readonly EARLY_ADOPTER: number;
|
|
488
714
|
};
|
|
489
|
-
constructor(bits?:
|
|
490
|
-
static resolve(bit:
|
|
491
|
-
}
|
|
492
|
-
declare interface ServerPermissions {
|
|
493
|
-
serialize(): Record<ServerPermissionsString, boolean>;
|
|
494
|
-
any(bit: ServerPermissionsResolvable): boolean;
|
|
495
|
-
add(...bits: ServerPermissionsResolvable[]): this;
|
|
496
|
-
remove(...bits: ServerPermissionsResolvable[]): this;
|
|
497
|
-
has(bit: ServerPermissionsResolvable): boolean;
|
|
498
|
-
}
|
|
499
|
-
declare class ServerPermissions extends BitField {
|
|
500
|
-
static readonly FLAGS: {
|
|
501
|
-
readonly VIEW_SERVER: number;
|
|
502
|
-
readonly MANAGE_ROLES: number;
|
|
503
|
-
readonly MANAGE_CHANNELS: number;
|
|
504
|
-
readonly MANAGE_SERVER: number;
|
|
505
|
-
readonly KICK_MEMBERS: number;
|
|
506
|
-
readonly BAN_MEMBERS: number;
|
|
507
|
-
readonly CHANGE_NICKNAME: number;
|
|
508
|
-
readonly MANAGE_NICKNAMES: number;
|
|
509
|
-
readonly CHANGE_AVATAR: number;
|
|
510
|
-
readonly REMOVE_AVATARS: number;
|
|
511
|
-
};
|
|
512
|
-
constructor(bits?: ServerPermissionsResolvable);
|
|
513
|
-
static resolve(bit: ServerPermissionsResolvable): number;
|
|
514
|
-
}
|
|
515
|
-
declare class FullPermissions extends BitField {
|
|
516
|
-
static readonly FLAGS: {
|
|
517
|
-
readonly ManageChannel: number;
|
|
518
|
-
readonly ManageServer: number;
|
|
519
|
-
readonly ManagePermissions: number;
|
|
520
|
-
readonly ManageRole: number;
|
|
521
|
-
readonly ManageCustomisation: number;
|
|
522
|
-
readonly KickMembers: number;
|
|
523
|
-
readonly BanMembers: number;
|
|
524
|
-
readonly TimeoutMembers: number;
|
|
525
|
-
readonly AssignRoles: number;
|
|
526
|
-
readonly ChangeNickname: number;
|
|
527
|
-
readonly ManageNicknames: number;
|
|
528
|
-
readonly ChangeAvatar: number;
|
|
529
|
-
readonly RemoveAvatars: number;
|
|
530
|
-
readonly ViewChannel: number;
|
|
531
|
-
readonly ReadMessageHistory: number;
|
|
532
|
-
readonly SendMessage: number;
|
|
533
|
-
readonly ManageMessages: number;
|
|
534
|
-
readonly ManageWebhooks: number;
|
|
535
|
-
readonly InviteOthers: number;
|
|
536
|
-
readonly SendEmbeds: number;
|
|
537
|
-
readonly UploadFiles: number;
|
|
538
|
-
readonly Masquerade: number;
|
|
539
|
-
readonly React: number;
|
|
540
|
-
readonly Connect: number;
|
|
541
|
-
readonly Speak: number;
|
|
542
|
-
readonly Video: number;
|
|
543
|
-
readonly MuteMembers: number;
|
|
544
|
-
readonly DeafenMembers: number;
|
|
545
|
-
readonly MoveMembers: number;
|
|
546
|
-
readonly MentionEveryone: number;
|
|
547
|
-
readonly MentionRoles: number;
|
|
548
|
-
readonly GrantAll: 4503599627370495;
|
|
549
|
-
};
|
|
550
|
-
constructor(bits?: number | string | FullPermissions | Array<number | string | FullPermissions>);
|
|
551
|
-
static resolve(bit: number | string | FullPermissions): number;
|
|
552
|
-
}
|
|
553
|
-
declare const DEFAULT_PERMISSION_DM: Readonly<ChannelPermissions>;
|
|
554
|
-
|
|
555
|
-
type BadgeString = keyof typeof Badges.FLAGS;
|
|
556
|
-
type BadgesResolvable = number | BadgeString | Badges | BadgesResolvable[];
|
|
557
|
-
declare interface Badges {
|
|
558
|
-
serialize(): Record<BadgeString, boolean>;
|
|
559
|
-
any(bit: BadgesResolvable): boolean;
|
|
560
|
-
add(...bits: BadgesResolvable[]): this;
|
|
561
|
-
remove(...bits: BadgesResolvable[]): this;
|
|
562
|
-
has(bit: BadgesResolvable): boolean;
|
|
563
|
-
}
|
|
564
|
-
declare class Badges extends BitField {
|
|
565
|
-
static readonly FLAGS: {
|
|
566
|
-
readonly DEVELOPER: number;
|
|
567
|
-
readonly TRANSLATOR: number;
|
|
568
|
-
readonly SUPPORTER: number;
|
|
569
|
-
readonly RESPONSIBLE_DISCLOSURE: number;
|
|
570
|
-
readonly REVOLT_TEAM: number;
|
|
571
|
-
readonly EARLY_ADOPTER: number;
|
|
572
|
-
};
|
|
573
|
-
constructor(bits?: BadgesResolvable);
|
|
574
|
-
static resolve(bit: BadgesResolvable): number;
|
|
715
|
+
constructor(bits?: BadgesResolvable);
|
|
716
|
+
static resolve(bit: BadgesResolvable): number;
|
|
575
717
|
}
|
|
576
718
|
|
|
577
719
|
/**
|
|
@@ -689,7 +831,7 @@ declare class MessageStruct extends Base {
|
|
|
689
831
|
/** An array of embeds included in the message. */
|
|
690
832
|
embeds: Embed[];
|
|
691
833
|
/** An array of file attachments included in the message. */
|
|
692
|
-
attachments: File[];
|
|
834
|
+
attachments: File$1[];
|
|
693
835
|
/** Mentions included in the message. */
|
|
694
836
|
mentions: Mentions;
|
|
695
837
|
/** The timestamp of when the message was last edited, or `null` if not edited. */
|
|
@@ -863,14 +1005,14 @@ declare class Attachment extends Base {
|
|
|
863
1005
|
/** The size of the attachment in bytes. */
|
|
864
1006
|
size: number;
|
|
865
1007
|
/** Metadata associated with the attachment (e.g., dimensions for images). */
|
|
866
|
-
metadata: File["metadata"];
|
|
1008
|
+
metadata: File$1["metadata"];
|
|
867
1009
|
/**
|
|
868
1010
|
* Creates a new Attachment instance.
|
|
869
1011
|
*
|
|
870
1012
|
* @param {client} client - The client instance.
|
|
871
1013
|
* @param {File} data - The raw data for the attachment from the API.
|
|
872
1014
|
*/
|
|
873
|
-
constructor(client: client, data: File);
|
|
1015
|
+
constructor(client: client, data: File$1);
|
|
874
1016
|
/**
|
|
875
1017
|
* Updates the attachment instance with new data from the API.
|
|
876
1018
|
*
|
|
@@ -878,7 +1020,7 @@ declare class Attachment extends Base {
|
|
|
878
1020
|
* @returns {this} The updated attachment instance.
|
|
879
1021
|
* @protected
|
|
880
1022
|
*/
|
|
881
|
-
protected _patch(data: File): this;
|
|
1023
|
+
protected _patch(data: File$1): this;
|
|
882
1024
|
}
|
|
883
1025
|
|
|
884
1026
|
/**
|
|
@@ -985,55 +1127,6 @@ declare class Server extends Base {
|
|
|
985
1127
|
toString(): string;
|
|
986
1128
|
}
|
|
987
1129
|
|
|
988
|
-
/**
|
|
989
|
-
* Represents the permissions that can be set for a role.
|
|
990
|
-
*/
|
|
991
|
-
type editablePermissions = {
|
|
992
|
-
/**
|
|
993
|
-
* Permissions to allow for the role.
|
|
994
|
-
* Each key corresponds to a permission flag in FullPermissions.
|
|
995
|
-
*/
|
|
996
|
-
a?: Array<keyof (typeof FullPermissions)["FLAGS"]>;
|
|
997
|
-
/**
|
|
998
|
-
* Permissions to deny for the role.
|
|
999
|
-
* Each key corresponds to a permission flag in FullPermissions.
|
|
1000
|
-
*/
|
|
1001
|
-
d?: Array<keyof (typeof FullPermissions)["FLAGS"]>;
|
|
1002
|
-
};
|
|
1003
|
-
/**
|
|
1004
|
-
* Represents a role that can be edited in a server.
|
|
1005
|
-
*/
|
|
1006
|
-
type editableRole = {
|
|
1007
|
-
/**
|
|
1008
|
-
* Name of the role.
|
|
1009
|
-
*/
|
|
1010
|
-
name?: string;
|
|
1011
|
-
/**
|
|
1012
|
-
* Colour of the role, or `null` if no colour is set.
|
|
1013
|
-
*/
|
|
1014
|
-
colour?: string | null;
|
|
1015
|
-
/**
|
|
1016
|
-
* Whether the role is displayed separately in the member list.
|
|
1017
|
-
*/
|
|
1018
|
-
hoist?: boolean;
|
|
1019
|
-
/**
|
|
1020
|
-
* Rank of the role, used for ordering.
|
|
1021
|
-
*/
|
|
1022
|
-
rank?: number;
|
|
1023
|
-
/**
|
|
1024
|
-
* Permissions to set for the role.
|
|
1025
|
-
* Format: { a: allow, d: deny }
|
|
1026
|
-
*/
|
|
1027
|
-
permissions?: editablePermissions;
|
|
1028
|
-
/**
|
|
1029
|
-
* Fields to remove from the role.
|
|
1030
|
-
* Each key corresponds to a field in the Role type.
|
|
1031
|
-
*/
|
|
1032
|
-
remove?: Array<keyof Role$1 & {
|
|
1033
|
-
[key: string]: unknown;
|
|
1034
|
-
}>;
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
1130
|
/**
|
|
1038
1131
|
* Represents a role in a server.
|
|
1039
1132
|
*
|
|
@@ -1110,6 +1203,172 @@ declare class Role extends Base {
|
|
|
1110
1203
|
toString(): string;
|
|
1111
1204
|
}
|
|
1112
1205
|
|
|
1206
|
+
/**
|
|
1207
|
+
* Represents a channel in the API.
|
|
1208
|
+
* @private
|
|
1209
|
+
*/
|
|
1210
|
+
type APIServerChannel = Extract<Channel$1, {
|
|
1211
|
+
channel_type: "TextChannel" | "VoiceChannel";
|
|
1212
|
+
}>;
|
|
1213
|
+
|
|
1214
|
+
type ServerChannelResolvable = ServerChannel | APIServerChannel | string;
|
|
1215
|
+
interface CreateChannelOptions {
|
|
1216
|
+
name: string;
|
|
1217
|
+
type?: "Text" | "Voice";
|
|
1218
|
+
description?: string;
|
|
1219
|
+
nsfw?: boolean;
|
|
1220
|
+
voice: {
|
|
1221
|
+
max_users?: number;
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
declare class ServerChannelManager extends BaseManager<ServerChannel> {
|
|
1225
|
+
protected readonly server: Server;
|
|
1226
|
+
/** @private */
|
|
1227
|
+
holds: typeof ServerChannel;
|
|
1228
|
+
constructor(server: Server);
|
|
1229
|
+
/** @private */
|
|
1230
|
+
_add(data: APIServerChannel): ServerChannel;
|
|
1231
|
+
/**
|
|
1232
|
+
* Creates a new channel in the server.
|
|
1233
|
+
* @param options - Options for creating the channel.
|
|
1234
|
+
* @param options.name - The name of the channel to create.
|
|
1235
|
+
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
1236
|
+
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
1237
|
+
* @returns A promise that resolves to the created channel.
|
|
1238
|
+
*/
|
|
1239
|
+
create({ name, type, description, }: CreateChannelOptions): Promise<ServerChannel>;
|
|
1240
|
+
/**
|
|
1241
|
+
* fetch a channel from the server
|
|
1242
|
+
* @param channel The channel to fetch. Can be a string, a channel object, or an API channel object.
|
|
1243
|
+
* @param force Whether to force fetch the channel from the API. Defaults to true.
|
|
1244
|
+
* If set to false, the method will return the channel from the cache if it exists.
|
|
1245
|
+
* @returns A promise that resolves to the fetched channel
|
|
1246
|
+
*/
|
|
1247
|
+
fetch(channel: ServerChannelResolvable, { force }?: {
|
|
1248
|
+
force?: boolean | undefined;
|
|
1249
|
+
}): Promise<ServerChannel>;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
type MessageResolvable = MessageStruct | Message | string;
|
|
1253
|
+
interface MessageReply {
|
|
1254
|
+
id: string;
|
|
1255
|
+
mention: boolean;
|
|
1256
|
+
}
|
|
1257
|
+
interface MessageOptions {
|
|
1258
|
+
content?: string;
|
|
1259
|
+
replies?: MessageReply[];
|
|
1260
|
+
attachments?: Readable[] | string[] | File$2[];
|
|
1261
|
+
embeds?: MessageEmbed[];
|
|
1262
|
+
masquerade?: Masquerade;
|
|
1263
|
+
}
|
|
1264
|
+
interface MessageEditOptions {
|
|
1265
|
+
content?: string;
|
|
1266
|
+
attachments?: string[];
|
|
1267
|
+
embeds?: MessageEmbed[];
|
|
1268
|
+
}
|
|
1269
|
+
interface MessageSearchOptions {
|
|
1270
|
+
query: string;
|
|
1271
|
+
limit?: number;
|
|
1272
|
+
before?: string;
|
|
1273
|
+
after?: string;
|
|
1274
|
+
sort?: MessageSort;
|
|
1275
|
+
}
|
|
1276
|
+
interface MessageQueryOptions {
|
|
1277
|
+
limit?: number;
|
|
1278
|
+
before?: string;
|
|
1279
|
+
after?: string;
|
|
1280
|
+
sort?: MessageSort;
|
|
1281
|
+
nearby?: string;
|
|
1282
|
+
}
|
|
1283
|
+
declare class MessageManager extends BaseManager<MessageStruct, Message> {
|
|
1284
|
+
protected readonly channel: Channel;
|
|
1285
|
+
/** @private */
|
|
1286
|
+
holds: typeof MessageStruct;
|
|
1287
|
+
constructor(channel: Channel, maxSize?: number);
|
|
1288
|
+
/**
|
|
1289
|
+
*
|
|
1290
|
+
* @param content The content to send. Can be a string or an object with the following properties:
|
|
1291
|
+
* - content: The content of the message
|
|
1292
|
+
* - replies: An array of message IDs to reply to
|
|
1293
|
+
* - attachments: An array of attachment URLs, Files, or ReadStreams
|
|
1294
|
+
* - embeds: An array of MessageEmbed objects
|
|
1295
|
+
* @returns Promise that resolves to the sent message
|
|
1296
|
+
*/
|
|
1297
|
+
send(content: MessageOptions | string): Promise<MessageStruct>;
|
|
1298
|
+
/**
|
|
1299
|
+
* acknowledge a message to mark it as read (not important for bots)
|
|
1300
|
+
* @param message The message to acknowledge
|
|
1301
|
+
* @returns Promise that resolves when the message is acknowledged
|
|
1302
|
+
*/
|
|
1303
|
+
ack(message: MessageResolvable): Promise<void>;
|
|
1304
|
+
/**
|
|
1305
|
+
* bulk delete messages from the channel
|
|
1306
|
+
* @param messages The messages to delete. Can be an array of message IDs or a Map of message IDs to Message objects.
|
|
1307
|
+
* @returns Promise that resolves when the messages are deleted
|
|
1308
|
+
*/
|
|
1309
|
+
bulkDelete(messages: MessageResolvable[] | number | Map<string, MessageStruct>): Promise<void>;
|
|
1310
|
+
/**
|
|
1311
|
+
* delete a message from the channel
|
|
1312
|
+
* @param message The message to delete. Can be a Message object or a message ID.
|
|
1313
|
+
* @returns Promise that resolves when the message is deleted
|
|
1314
|
+
*/
|
|
1315
|
+
delete(message: MessageResolvable): Promise<void>;
|
|
1316
|
+
/**
|
|
1317
|
+
* edit a message in the channel
|
|
1318
|
+
* @param message The message to edit. Can be a Message object or a message ID.
|
|
1319
|
+
* @param options The options to edit the message with. Can be a string or an object with the following properties:
|
|
1320
|
+
* - content: The new content of the message
|
|
1321
|
+
* - attachments: An array of attachment URLs
|
|
1322
|
+
* - embeds: An array of MessageEmbed objects
|
|
1323
|
+
* @returns Promise that resolves when the message is edited
|
|
1324
|
+
*/
|
|
1325
|
+
edit(message: MessageResolvable, options: MessageEditOptions | string): Promise<void>;
|
|
1326
|
+
/**
|
|
1327
|
+
* search for messages in the channel
|
|
1328
|
+
* @param query The query to search for. Can be a string or an object with the following properties:
|
|
1329
|
+
* - query: The query to search for
|
|
1330
|
+
* - limit: The maximum number of messages to return
|
|
1331
|
+
* - before: The message ID to start searching from (exclusive)
|
|
1332
|
+
* - after: The message ID to stop searching at (exclusive)
|
|
1333
|
+
* - sort: The sort order of the results (asc or desc)
|
|
1334
|
+
* @returns Promise that resolves to a Map of message IDs to Message objects
|
|
1335
|
+
*/
|
|
1336
|
+
search(query: MessageSearchOptions | string): Promise<Map<string, MessageStruct>>;
|
|
1337
|
+
/**
|
|
1338
|
+
* fetch a message from the channel
|
|
1339
|
+
* @param message The message to fetch. Can be a Message object, a message ID, or an object with the following properties:
|
|
1340
|
+
* - limit: The maximum number of messages to return
|
|
1341
|
+
* - before: The message ID to start fetching from (exclusive)
|
|
1342
|
+
* - after: The message ID to stop fetching at (exclusive)
|
|
1343
|
+
* @returns Promise that resolves to a Message object or a Map of message IDs to Message objects
|
|
1344
|
+
*/
|
|
1345
|
+
fetch(message: MessageResolvable): Promise<MessageStruct>;
|
|
1346
|
+
fetch(query?: MessageQueryOptions): Promise<Map<string, MessageStruct>>;
|
|
1347
|
+
fetch(limit: number): Promise<Map<string, MessageStruct>>;
|
|
1348
|
+
/**
|
|
1349
|
+
* add a reaction to a message
|
|
1350
|
+
* @param message The message to react to. Can be a Message object or a message ID.
|
|
1351
|
+
* @param emoji emoji to react with. Can be a string or an Emoji object.
|
|
1352
|
+
* @returns Promise that resolves when the reaction is added
|
|
1353
|
+
*/
|
|
1354
|
+
addReaction(message: MessageResolvable | string, emoji: string | Emoji): Promise<void>;
|
|
1355
|
+
/**
|
|
1356
|
+
*
|
|
1357
|
+
* @param message The message to unreact. Can be a Message object or a message ID.
|
|
1358
|
+
* @param emoji the emoji to unreact with. Can be a string or an Emoji object.
|
|
1359
|
+
* @param user_id The user ID to remove the reaction for. If not provided, removes the reaction for the current user.
|
|
1360
|
+
* @param remove_all Whether to remove all of the specified reaction for the message. Defaults to false.
|
|
1361
|
+
* @returns Promise that resolves when the reaction is removed
|
|
1362
|
+
*/
|
|
1363
|
+
removeReaction(message: MessageResolvable | string, emoji: string | Emoji, user_id?: string, remove_all?: boolean): Promise<void>;
|
|
1364
|
+
/**
|
|
1365
|
+
* remove all reactions from a message
|
|
1366
|
+
* @param message The message to remove reactions from. Can be a Message object or a message ID.
|
|
1367
|
+
* @returns Promise that resolves when the reactions are removed
|
|
1368
|
+
*/
|
|
1369
|
+
removeAllReactions(message: MessageResolvable | string): Promise<void>;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1113
1372
|
/**
|
|
1114
1373
|
* Represents a generic communication channel in the client.
|
|
1115
1374
|
* This abstract class provides a base structure and common functionality
|
|
@@ -1160,38 +1419,270 @@ declare abstract class Channel extends Base {
|
|
|
1160
1419
|
*
|
|
1161
1420
|
* @returns {boolean} True if the channel is a text-based channel, otherwise false.
|
|
1162
1421
|
*/
|
|
1163
|
-
isText(): this is TextChannel | GroupChannel | DMChannel;
|
|
1422
|
+
isText(): this is TextChannel | GroupChannel | DMChannel;
|
|
1423
|
+
/**
|
|
1424
|
+
* Checks if the channel is a voice channel.
|
|
1425
|
+
*
|
|
1426
|
+
* @returns {boolean} True if the channel is a voice channel, otherwise false.
|
|
1427
|
+
*/
|
|
1428
|
+
isVoice(): this is VoiceChannel;
|
|
1429
|
+
/**
|
|
1430
|
+
* Checks if the channel is a group channel.
|
|
1431
|
+
*
|
|
1432
|
+
* @returns {boolean} True if the channel is a group channel, otherwise false.
|
|
1433
|
+
*/
|
|
1434
|
+
isGroup(): this is GroupChannel;
|
|
1435
|
+
/**
|
|
1436
|
+
* Checks if the channel is part of a server.
|
|
1437
|
+
*
|
|
1438
|
+
* @returns {boolean} True if the channel is a server channel, otherwise false.
|
|
1439
|
+
*/
|
|
1440
|
+
inServer(): this is ServerChannel;
|
|
1441
|
+
/**
|
|
1442
|
+
* Converts the channel to a string representation.
|
|
1443
|
+
*
|
|
1444
|
+
* @returns {string} A string representation of the channel in the format `<#channelId>`.
|
|
1445
|
+
*/
|
|
1446
|
+
toString(): string;
|
|
1447
|
+
/**
|
|
1448
|
+
* Fetches the latest data for the channel from the client's channel collection.
|
|
1449
|
+
*
|
|
1450
|
+
* @param {boolean} [force=true] - Whether to force a fetch even if the channel is cached.
|
|
1451
|
+
* @returns {Promise<Channel>} A promise that resolves with the updated channel instance.
|
|
1452
|
+
*/
|
|
1453
|
+
fetch(force?: boolean): Promise<Channel>;
|
|
1454
|
+
edit(data: Partial<CreateChannelOptions>): Promise<{
|
|
1455
|
+
channel_type: string;
|
|
1456
|
+
_id: string;
|
|
1457
|
+
user: string;
|
|
1458
|
+
}>;
|
|
1459
|
+
/**
|
|
1460
|
+
* Sets role permissions for this channel.
|
|
1461
|
+
*
|
|
1462
|
+
* @param roleId - The ID of the role to set permissions for.
|
|
1463
|
+
* @param allow - Array of permissions to allow for the role.
|
|
1464
|
+
* @returns A promise that resolves when the permissions have been updated.
|
|
1465
|
+
*
|
|
1466
|
+
* @throws {TypeError} If the channel ID is invalid.
|
|
1467
|
+
*
|
|
1468
|
+
* @example
|
|
1469
|
+
* ```typescript
|
|
1470
|
+
* // Allow specific permissions
|
|
1471
|
+
* await channel.setRolePermissions(roleId, ["ViewChannel", "SendMessage"]);
|
|
1472
|
+
* ```
|
|
1473
|
+
*/
|
|
1474
|
+
setRolePermissions(roleId: string, allow: editablePermissions["a"]): Promise<void>;
|
|
1475
|
+
/**
|
|
1476
|
+
* Sets role permissions for this channel.
|
|
1477
|
+
*
|
|
1478
|
+
* @param roleId - The ID of the role to set permissions for.
|
|
1479
|
+
* @param allow - Array of permissions to allow for the role.
|
|
1480
|
+
* @param deny - Array of permissions to deny for the role.
|
|
1481
|
+
* @returns A promise that resolves when the permissions have been updated.
|
|
1482
|
+
*
|
|
1483
|
+
* @throws {TypeError} If the channel ID is invalid.
|
|
1484
|
+
*
|
|
1485
|
+
* @example
|
|
1486
|
+
* ```typescript
|
|
1487
|
+
* // Set both allow and deny permissions
|
|
1488
|
+
* await channel.setRolePermissions(roleId, ["ViewChannel"], ["ManageMessages"]);
|
|
1489
|
+
* ```
|
|
1490
|
+
*/
|
|
1491
|
+
setRolePermissions(roleId: string, allow: editablePermissions["a"], deny: editablePermissions["d"]): Promise<void>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Sets role permissions for this channel.
|
|
1494
|
+
*
|
|
1495
|
+
* @param roleId - The ID of the role to set permissions for.
|
|
1496
|
+
* @param options - Object containing allow and/or deny permissions.
|
|
1497
|
+
* @returns A promise that resolves when the permissions have been updated.
|
|
1498
|
+
*
|
|
1499
|
+
* @throws {TypeError} If the channel ID is invalid or if both allow and deny are undefined.
|
|
1500
|
+
*
|
|
1501
|
+
* @example
|
|
1502
|
+
* ```typescript
|
|
1503
|
+
* // Allow specific permissions only
|
|
1504
|
+
* await channel.setRolePermissions(roleId, { allow: ["ViewChannel", "SendMessage"] });
|
|
1505
|
+
*
|
|
1506
|
+
* // Deny specific permissions only
|
|
1507
|
+
* await channel.setRolePermissions(roleId, { deny: ["ManageMessages"] });
|
|
1508
|
+
*
|
|
1509
|
+
* // Set both allow and deny permissions
|
|
1510
|
+
* await channel.setRolePermissions(roleId, {
|
|
1511
|
+
* allow: ["ViewChannel"],
|
|
1512
|
+
* deny: ["ManageMessages"]
|
|
1513
|
+
* });
|
|
1514
|
+
* ```
|
|
1515
|
+
*/
|
|
1516
|
+
setRolePermissions(roleId: string, options: {
|
|
1517
|
+
allow?: editablePermissions["a"];
|
|
1518
|
+
deny?: editablePermissions["d"];
|
|
1519
|
+
}): Promise<void>;
|
|
1520
|
+
/**
|
|
1521
|
+
* Sets default permissions for this channel.
|
|
1522
|
+
*
|
|
1523
|
+
* @param allow - Array of permissions to allow by default.
|
|
1524
|
+
* @returns A promise that resolves when the permissions have been updated.
|
|
1525
|
+
*
|
|
1526
|
+
* @throws {TypeError} If the channel ID is invalid.
|
|
1527
|
+
*
|
|
1528
|
+
* @example
|
|
1529
|
+
* ```typescript
|
|
1530
|
+
* // Allow specific permissions
|
|
1531
|
+
* await channel.setDefaultPermissions(["ViewChannel", "SendMessage"]);
|
|
1532
|
+
* ```
|
|
1533
|
+
*/
|
|
1534
|
+
setDefaultPermissions(allow: editablePermissions["a"]): Promise<void>;
|
|
1535
|
+
/**
|
|
1536
|
+
* Sets default permissions for this channel.
|
|
1537
|
+
*
|
|
1538
|
+
* @param options - Object containing allow and/or deny permissions.
|
|
1539
|
+
* @returns A promise that resolves when the permissions have been updated.
|
|
1540
|
+
*
|
|
1541
|
+
* @throws {TypeError} If the channel ID is invalid or if both allow and deny are undefined.
|
|
1542
|
+
*
|
|
1543
|
+
* @example
|
|
1544
|
+
* ```typescript
|
|
1545
|
+
* // Allow specific permissions only
|
|
1546
|
+
* await channel.setDefaultPermissions({ allow: ["ViewChannel", "SendMessage"] });
|
|
1547
|
+
*
|
|
1548
|
+
* // Deny specific permissions only
|
|
1549
|
+
* await channel.setDefaultPermissions({ deny: ["ManageMessages"] });
|
|
1550
|
+
*
|
|
1551
|
+
* // Set both allow and deny permissions
|
|
1552
|
+
* await channel.setDefaultPermissions({
|
|
1553
|
+
* allow: ["ViewChannel"],
|
|
1554
|
+
* deny: ["ManageMessages"]
|
|
1555
|
+
* });
|
|
1556
|
+
* ```
|
|
1557
|
+
*/
|
|
1558
|
+
setDefaultPermissions(options: {
|
|
1559
|
+
allow?: editablePermissions["a"];
|
|
1560
|
+
deny?: editablePermissions["d"];
|
|
1561
|
+
}): Promise<void>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Sets default permissions for this channel (legacy format).
|
|
1564
|
+
*
|
|
1565
|
+
* @param permissions - Object containing allow and deny permissions.
|
|
1566
|
+
* @returns A promise that resolves when the permissions have been updated.
|
|
1567
|
+
*
|
|
1568
|
+
* @throws {TypeError} If the channel ID is invalid.
|
|
1569
|
+
*
|
|
1570
|
+
* @example
|
|
1571
|
+
* ```typescript
|
|
1572
|
+
* // Legacy format
|
|
1573
|
+
* await channel.setDefaultPermissions({
|
|
1574
|
+
* a: ["ViewChannel"],
|
|
1575
|
+
* d: ["ManageMessages"]
|
|
1576
|
+
* });
|
|
1577
|
+
* ```
|
|
1578
|
+
*/
|
|
1579
|
+
setDefaultPermissions(permissions: editablePermissions): Promise<void>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Creates a new webhook in this channel.
|
|
1582
|
+
*
|
|
1583
|
+
* @param name - The name of the webhook
|
|
1584
|
+
* @param avatar - Optional avatar for the webhook. Can be a URL string, Readable stream, or File object
|
|
1585
|
+
* @returns Promise resolving to the created webhook response
|
|
1586
|
+
*
|
|
1587
|
+
* @example
|
|
1588
|
+
* ```typescript
|
|
1589
|
+
* const webhook = await channel.createWebhook("My Webhook", "https://example.com/avatar.png");
|
|
1590
|
+
* ```
|
|
1591
|
+
*/
|
|
1592
|
+
createWebhook(name: string, avatar?: Readable | string | File): Promise<createWebhookResponse>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Retrieves all webhooks for this channel.
|
|
1595
|
+
*
|
|
1596
|
+
* @returns Promise resolving to an array of webhook responses
|
|
1597
|
+
*
|
|
1598
|
+
* @example
|
|
1599
|
+
* ```typescript
|
|
1600
|
+
* const webhooks = await channel.getWebhooks();
|
|
1601
|
+
* console.log(`Found ${webhooks.length} webhooks`);
|
|
1602
|
+
* ```
|
|
1603
|
+
*/
|
|
1604
|
+
getWebhooks(): Promise<createWebhookResponse[]>;
|
|
1164
1605
|
/**
|
|
1165
|
-
*
|
|
1606
|
+
* Retrieves a specific webhook by ID and token.
|
|
1166
1607
|
*
|
|
1167
|
-
* @
|
|
1608
|
+
* @param webhookId - The ID of the webhook to retrieve
|
|
1609
|
+
* @param token - The token of the webhook
|
|
1610
|
+
* @returns Promise resolving to the webhook response
|
|
1611
|
+
*
|
|
1612
|
+
* @example
|
|
1613
|
+
* ```typescript
|
|
1614
|
+
* const webhook = await channel.getWebhook("webhookId", "webhookToken");
|
|
1615
|
+
* console.log(`Webhook name: ${webhook.name}`);
|
|
1616
|
+
* ```
|
|
1168
1617
|
*/
|
|
1169
|
-
|
|
1618
|
+
getWebhook(webhookId: string, token: string): Promise<createWebhookResponse>;
|
|
1170
1619
|
/**
|
|
1171
|
-
*
|
|
1620
|
+
* Sends a message through a webhook in this channel.
|
|
1172
1621
|
*
|
|
1173
|
-
* @
|
|
1622
|
+
* @param webhookId - The ID of the webhook to send the message through
|
|
1623
|
+
* @param token - The token of the webhook
|
|
1624
|
+
* @param content - The message content. Can be a string or MessageOptions object with attachments and embeds
|
|
1625
|
+
* @returns Promise resolving to the sent message
|
|
1626
|
+
*
|
|
1627
|
+
* @example
|
|
1628
|
+
* ```typescript
|
|
1629
|
+
* // Send a simple text message
|
|
1630
|
+
* await channel.sendWebhookMessage("webhookId", "token", "Hello, world!");
|
|
1631
|
+
*
|
|
1632
|
+
* // Send a message with embeds and attachments
|
|
1633
|
+
* await channel.sendWebhookMessage("webhookId", "token", {
|
|
1634
|
+
* content: "Check out this image!",
|
|
1635
|
+
* attachments: ["https://example.com/image.png"],
|
|
1636
|
+
* embeds: [myEmbed]
|
|
1637
|
+
* });
|
|
1638
|
+
* ```
|
|
1174
1639
|
*/
|
|
1175
|
-
|
|
1640
|
+
sendWebhookMessage(webhookId: string, token: string, content: MessageOptions | string): Promise<Message>;
|
|
1176
1641
|
/**
|
|
1177
|
-
*
|
|
1642
|
+
* Deletes a webhook.
|
|
1178
1643
|
*
|
|
1179
|
-
* @
|
|
1644
|
+
* @param webhookId - The ID of the webhook to delete
|
|
1645
|
+
* @param token - The token of the webhook
|
|
1646
|
+
* @returns Promise that resolves when the webhook is deleted
|
|
1647
|
+
*
|
|
1648
|
+
* @example
|
|
1649
|
+
* ```typescript
|
|
1650
|
+
* await channel.deleteWebhook("webhookId", "webhookToken");
|
|
1651
|
+
* console.log("Webhook deleted successfully");
|
|
1652
|
+
* ```
|
|
1180
1653
|
*/
|
|
1181
|
-
|
|
1654
|
+
deleteWebhook(webhookId: string, token: string): Promise<void>;
|
|
1182
1655
|
/**
|
|
1183
|
-
*
|
|
1656
|
+
* Edits a webhook's properties.
|
|
1184
1657
|
*
|
|
1185
|
-
* @
|
|
1658
|
+
* @param webhookId - The ID of the webhook to edit
|
|
1659
|
+
* @param token - The token of the webhook
|
|
1660
|
+
* @param options - The options to edit on the webhook
|
|
1661
|
+
* @returns Promise resolving to the updated webhook response
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* ```typescript
|
|
1665
|
+
* const updatedWebhook = await channel.editWebhook("webhookId", "token", {
|
|
1666
|
+
* name: "New Webhook Name",
|
|
1667
|
+
* avatar: "https://example.com/new-avatar.png"
|
|
1668
|
+
* });
|
|
1669
|
+
* ```
|
|
1186
1670
|
*/
|
|
1187
|
-
|
|
1671
|
+
editWebhook(webhookId: string, token: string, options: editWebhookOptions): Promise<createWebhookResponse>;
|
|
1188
1672
|
/**
|
|
1189
|
-
*
|
|
1673
|
+
* Retrieves partial information about a webhook using only its ID.
|
|
1674
|
+
* This method provides limited webhook information without requiring a token.
|
|
1190
1675
|
*
|
|
1191
|
-
* @param
|
|
1192
|
-
* @returns
|
|
1676
|
+
* @param webhookId - The ID of the webhook to retrieve partial information for
|
|
1677
|
+
* @returns Promise resolving to the webhook response with partial information
|
|
1678
|
+
*
|
|
1679
|
+
* @example
|
|
1680
|
+
* ```typescript
|
|
1681
|
+
* const partialWebhook = await channel.getPartialWebhook("webhookId");
|
|
1682
|
+
* console.log(`Webhook name: ${partialWebhook.name}`);
|
|
1683
|
+
* ```
|
|
1193
1684
|
*/
|
|
1194
|
-
|
|
1685
|
+
getPartialWebhook(webhookId: string): Promise<createWebhookResponse>;
|
|
1195
1686
|
}
|
|
1196
1687
|
|
|
1197
1688
|
/**
|
|
@@ -1584,7 +2075,7 @@ declare class MessageEmbed {
|
|
|
1584
2075
|
* @param {Readable | string | File} media - The media URL, File or Stream to set.
|
|
1585
2076
|
* @returns {this} The updated `MessageEmbed` instance.
|
|
1586
2077
|
*/
|
|
1587
|
-
setMedia(media: Readable | string | File$
|
|
2078
|
+
setMedia(media: Readable | string | File$2): this;
|
|
1588
2079
|
/**
|
|
1589
2080
|
*
|
|
1590
2081
|
* @param client The client instance used to send the embed.
|
|
@@ -1670,14 +2161,6 @@ declare class NotesChannel extends Channel implements TextBasedChannel {
|
|
|
1670
2161
|
get user(): User;
|
|
1671
2162
|
}
|
|
1672
2163
|
|
|
1673
|
-
/**
|
|
1674
|
-
* Represents a channel in the API.
|
|
1675
|
-
* @private
|
|
1676
|
-
*/
|
|
1677
|
-
type APIServerChannel = Extract<Channel$1, {
|
|
1678
|
-
channel_type: "TextChannel" | "VoiceChannel";
|
|
1679
|
-
}>;
|
|
1680
|
-
|
|
1681
2164
|
interface Overwrite {
|
|
1682
2165
|
allow: FullPermissions;
|
|
1683
2166
|
deny: FullPermissions;
|
|
@@ -2123,6 +2606,128 @@ declare class UserManager extends BaseManager<User, User$1> {
|
|
|
2123
2606
|
resolveId(resolvable: UserResolvable): string | null;
|
|
2124
2607
|
}
|
|
2125
2608
|
|
|
2609
|
+
/**
|
|
2610
|
+
* Manages webhooks for the client.
|
|
2611
|
+
* Provides methods for creating, managing, and sending messages through webhooks.
|
|
2612
|
+
*/
|
|
2613
|
+
declare class WebhookManager {
|
|
2614
|
+
protected readonly client: client;
|
|
2615
|
+
/**
|
|
2616
|
+
* Creates a new WebhookManager instance.
|
|
2617
|
+
*
|
|
2618
|
+
* @param client - The client instance this manager belongs to
|
|
2619
|
+
*/
|
|
2620
|
+
constructor(client: client);
|
|
2621
|
+
/**
|
|
2622
|
+
* Creates a new webhook in the specified channel.
|
|
2623
|
+
*
|
|
2624
|
+
* @param channelId - The ID of the channel where the webhook will be created
|
|
2625
|
+
* @param name - The name of the webhook
|
|
2626
|
+
* @param avatar - Optional avatar for the webhook. Can be a URL string, Readable stream, or File object
|
|
2627
|
+
* @returns Promise resolving to the created webhook response
|
|
2628
|
+
*
|
|
2629
|
+
* @example
|
|
2630
|
+
* ```typescript
|
|
2631
|
+
* const webhook = await client.webhooks.create("channelId", "My Webhook", "https://example.com/avatar.png");
|
|
2632
|
+
* ```
|
|
2633
|
+
*/
|
|
2634
|
+
create(channelId: string, name: string, avatar?: Readable | string | File): Promise<createWebhookResponse>;
|
|
2635
|
+
/**
|
|
2636
|
+
* Retrieves all webhooks for the specified channel.
|
|
2637
|
+
*
|
|
2638
|
+
* @param channelId - The ID of the channel to get webhooks from
|
|
2639
|
+
* @returns Promise resolving to an array of webhook responses
|
|
2640
|
+
*
|
|
2641
|
+
* @example
|
|
2642
|
+
* ```typescript
|
|
2643
|
+
* const webhooks = await client.webhooks.getAll("channelId");
|
|
2644
|
+
* console.log(`Found ${webhooks.length} webhooks`);
|
|
2645
|
+
* ```
|
|
2646
|
+
*/
|
|
2647
|
+
getAll(channelId: string): Promise<createWebhookResponse[]>;
|
|
2648
|
+
/**
|
|
2649
|
+
* Retrieves a specific webhook by ID and token.
|
|
2650
|
+
*
|
|
2651
|
+
* @param webhookId - The ID of the webhook to retrieve
|
|
2652
|
+
* @param token - The token of the webhook
|
|
2653
|
+
* @returns Promise resolving to the webhook response
|
|
2654
|
+
*
|
|
2655
|
+
* @example
|
|
2656
|
+
* ```typescript
|
|
2657
|
+
* const webhook = await client.webhooks.get("webhookId", "webhookToken");
|
|
2658
|
+
* console.log(`Webhook name: ${webhook.name}`);
|
|
2659
|
+
* ```
|
|
2660
|
+
*/
|
|
2661
|
+
get(webhookId: string, token: string): Promise<createWebhookResponse>;
|
|
2662
|
+
/**
|
|
2663
|
+
* Sends a message through a webhook.
|
|
2664
|
+
*
|
|
2665
|
+
* @param webhookId - The ID of the webhook to send the message through
|
|
2666
|
+
* @param token - The token of the webhook
|
|
2667
|
+
* @param content - The message content. Can be a string or MessageOptions object with attachments and embeds
|
|
2668
|
+
* @returns Promise resolving to the sent message
|
|
2669
|
+
*
|
|
2670
|
+
* @example
|
|
2671
|
+
* ```typescript
|
|
2672
|
+
* // Send a simple text message
|
|
2673
|
+
* await client.webhooks.send("webhookId", "token", "Hello, world!");
|
|
2674
|
+
*
|
|
2675
|
+
* // Send a message with embeds and attachments
|
|
2676
|
+
* await client.webhooks.send("webhookId", "token", {
|
|
2677
|
+
* content: "Check out this image!",
|
|
2678
|
+
* attachments: ["https://example.com/image.png"],
|
|
2679
|
+
* embeds: [myEmbed]
|
|
2680
|
+
* });
|
|
2681
|
+
* ```
|
|
2682
|
+
*/
|
|
2683
|
+
send(webhookId: string, token: string, content: MessageOptions | string): Promise<Message>;
|
|
2684
|
+
/**
|
|
2685
|
+
* Deletes a webhook.
|
|
2686
|
+
*
|
|
2687
|
+
* @param webhookId - The ID of the webhook to delete
|
|
2688
|
+
* @param token - The token of the webhook
|
|
2689
|
+
* @returns Promise that resolves when the webhook is deleted
|
|
2690
|
+
*
|
|
2691
|
+
* @example
|
|
2692
|
+
* ```typescript
|
|
2693
|
+
* await client.webhooks.delete("webhookId", "webhookToken");
|
|
2694
|
+
* console.log("Webhook deleted successfully");
|
|
2695
|
+
* ```
|
|
2696
|
+
*/
|
|
2697
|
+
delete(webhookId: string, token: string): Promise<void>;
|
|
2698
|
+
/**
|
|
2699
|
+
* Edits a webhook's properties.
|
|
2700
|
+
*
|
|
2701
|
+
* @param webhookId - The ID of the webhook to edit
|
|
2702
|
+
* @param token - The token of the webhook
|
|
2703
|
+
* @param options - The options to edit on the webhook
|
|
2704
|
+
* @returns Promise resolving to the updated webhook response
|
|
2705
|
+
*
|
|
2706
|
+
* @example
|
|
2707
|
+
* ```typescript
|
|
2708
|
+
* const updatedWebhook = await client.webhooks.edit("webhookId", "token", {
|
|
2709
|
+
* name: "New Webhook Name",
|
|
2710
|
+
* avatar: "https://example.com/new-avatar.png"
|
|
2711
|
+
* });
|
|
2712
|
+
* ```
|
|
2713
|
+
*/
|
|
2714
|
+
edit(webhookId: string, token: string, options: editWebhookOptions): Promise<createWebhookResponse>;
|
|
2715
|
+
/**
|
|
2716
|
+
* Retrieves partial information about a webhook using only its ID.
|
|
2717
|
+
* This method provides limited webhook information without requiring a token.
|
|
2718
|
+
*
|
|
2719
|
+
* @param webhookId - The ID of the webhook to retrieve partial information for
|
|
2720
|
+
* @returns Promise resolving to the webhook response with partial information
|
|
2721
|
+
*
|
|
2722
|
+
* @example
|
|
2723
|
+
* ```typescript
|
|
2724
|
+
* const partialWebhook = await client.webhooks.getPartial("webhookId");
|
|
2725
|
+
* console.log(`Webhook name: ${partialWebhook.name}`);
|
|
2726
|
+
* ```
|
|
2727
|
+
*/
|
|
2728
|
+
getPartial(webhookId: string): Promise<createWebhookResponse>;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2126
2731
|
/**
|
|
2127
2732
|
* Represents the client user, which is the authenticated user or bot.
|
|
2128
2733
|
*
|
|
@@ -2338,6 +2943,8 @@ declare class client extends BaseClient {
|
|
|
2338
2943
|
readonly users: UserManager;
|
|
2339
2944
|
/** Manages the events in the client. */
|
|
2340
2945
|
readonly events: EventManager;
|
|
2946
|
+
/** Manages the webhooks in the client. */
|
|
2947
|
+
readonly webhooks: WebhookManager;
|
|
2341
2948
|
/** The authenticated user, or `null` if not logged in. */
|
|
2342
2949
|
user: ClientUser | null;
|
|
2343
2950
|
/** The timestamp when the client became ready, or `null` if not ready. */
|
|
@@ -2500,126 +3107,6 @@ declare class ServerManager extends BaseManager<Server, Server$1> {
|
|
|
2500
3107
|
}): Promise<Server>;
|
|
2501
3108
|
}
|
|
2502
3109
|
|
|
2503
|
-
type MessageResolvable = MessageStruct | Message | string;
|
|
2504
|
-
interface MessageReply {
|
|
2505
|
-
id: string;
|
|
2506
|
-
mention: boolean;
|
|
2507
|
-
}
|
|
2508
|
-
interface MessageOptions {
|
|
2509
|
-
content?: string;
|
|
2510
|
-
replies?: MessageReply[];
|
|
2511
|
-
attachments?: Readable[] | string[] | File$1[];
|
|
2512
|
-
embeds?: MessageEmbed[];
|
|
2513
|
-
masquerade?: Masquerade;
|
|
2514
|
-
}
|
|
2515
|
-
interface MessageEditOptions {
|
|
2516
|
-
content?: string;
|
|
2517
|
-
attachments?: string[];
|
|
2518
|
-
embeds?: MessageEmbed[];
|
|
2519
|
-
}
|
|
2520
|
-
interface MessageSearchOptions {
|
|
2521
|
-
query: string;
|
|
2522
|
-
limit?: number;
|
|
2523
|
-
before?: string;
|
|
2524
|
-
after?: string;
|
|
2525
|
-
sort?: MessageSort;
|
|
2526
|
-
}
|
|
2527
|
-
interface MessageQueryOptions {
|
|
2528
|
-
limit?: number;
|
|
2529
|
-
before?: string;
|
|
2530
|
-
after?: string;
|
|
2531
|
-
sort?: MessageSort;
|
|
2532
|
-
nearby?: string;
|
|
2533
|
-
}
|
|
2534
|
-
declare class MessageManager extends BaseManager<MessageStruct, Message> {
|
|
2535
|
-
protected readonly channel: Channel;
|
|
2536
|
-
/** @private */
|
|
2537
|
-
holds: typeof MessageStruct;
|
|
2538
|
-
constructor(channel: Channel, maxSize?: number);
|
|
2539
|
-
/**
|
|
2540
|
-
*
|
|
2541
|
-
* @param content The content to send. Can be a string or an object with the following properties:
|
|
2542
|
-
* - content: The content of the message
|
|
2543
|
-
* - replies: An array of message IDs to reply to
|
|
2544
|
-
* - attachments: An array of attachment URLs, Files, or ReadStreams
|
|
2545
|
-
* - embeds: An array of MessageEmbed objects
|
|
2546
|
-
* @returns Promise that resolves to the sent message
|
|
2547
|
-
*/
|
|
2548
|
-
send(content: MessageOptions | string): Promise<MessageStruct>;
|
|
2549
|
-
/**
|
|
2550
|
-
* acknowledge a message to mark it as read (not important for bots)
|
|
2551
|
-
* @param message The message to acknowledge
|
|
2552
|
-
* @returns Promise that resolves when the message is acknowledged
|
|
2553
|
-
*/
|
|
2554
|
-
ack(message: MessageResolvable): Promise<void>;
|
|
2555
|
-
/**
|
|
2556
|
-
* bulk delete messages from the channel
|
|
2557
|
-
* @param messages The messages to delete. Can be an array of message IDs or a Map of message IDs to Message objects.
|
|
2558
|
-
* @returns Promise that resolves when the messages are deleted
|
|
2559
|
-
*/
|
|
2560
|
-
bulkDelete(messages: MessageResolvable[] | number | Map<string, MessageStruct>): Promise<void>;
|
|
2561
|
-
/**
|
|
2562
|
-
* delete a message from the channel
|
|
2563
|
-
* @param message The message to delete. Can be a Message object or a message ID.
|
|
2564
|
-
* @returns Promise that resolves when the message is deleted
|
|
2565
|
-
*/
|
|
2566
|
-
delete(message: MessageResolvable): Promise<void>;
|
|
2567
|
-
/**
|
|
2568
|
-
* edit a message in the channel
|
|
2569
|
-
* @param message The message to edit. Can be a Message object or a message ID.
|
|
2570
|
-
* @param options The options to edit the message with. Can be a string or an object with the following properties:
|
|
2571
|
-
* - content: The new content of the message
|
|
2572
|
-
* - attachments: An array of attachment URLs
|
|
2573
|
-
* - embeds: An array of MessageEmbed objects
|
|
2574
|
-
* @returns Promise that resolves when the message is edited
|
|
2575
|
-
*/
|
|
2576
|
-
edit(message: MessageResolvable, options: MessageEditOptions | string): Promise<void>;
|
|
2577
|
-
/**
|
|
2578
|
-
* search for messages in the channel
|
|
2579
|
-
* @param query The query to search for. Can be a string or an object with the following properties:
|
|
2580
|
-
* - query: The query to search for
|
|
2581
|
-
* - limit: The maximum number of messages to return
|
|
2582
|
-
* - before: The message ID to start searching from (exclusive)
|
|
2583
|
-
* - after: The message ID to stop searching at (exclusive)
|
|
2584
|
-
* - sort: The sort order of the results (asc or desc)
|
|
2585
|
-
* @returns Promise that resolves to a Map of message IDs to Message objects
|
|
2586
|
-
*/
|
|
2587
|
-
search(query: MessageSearchOptions | string): Promise<Map<string, MessageStruct>>;
|
|
2588
|
-
/**
|
|
2589
|
-
* fetch a message from the channel
|
|
2590
|
-
* @param message The message to fetch. Can be a Message object, a message ID, or an object with the following properties:
|
|
2591
|
-
* - limit: The maximum number of messages to return
|
|
2592
|
-
* - before: The message ID to start fetching from (exclusive)
|
|
2593
|
-
* - after: The message ID to stop fetching at (exclusive)
|
|
2594
|
-
* @returns Promise that resolves to a Message object or a Map of message IDs to Message objects
|
|
2595
|
-
*/
|
|
2596
|
-
fetch(message: MessageResolvable): Promise<MessageStruct>;
|
|
2597
|
-
fetch(query?: MessageQueryOptions): Promise<Map<string, MessageStruct>>;
|
|
2598
|
-
fetch(limit: number): Promise<Map<string, MessageStruct>>;
|
|
2599
|
-
/**
|
|
2600
|
-
* add a reaction to a message
|
|
2601
|
-
* @param message The message to react to. Can be a Message object or a message ID.
|
|
2602
|
-
* @param emoji emoji to react with. Can be a string or an Emoji object.
|
|
2603
|
-
* @returns Promise that resolves when the reaction is added
|
|
2604
|
-
*/
|
|
2605
|
-
addReaction(message: MessageResolvable | string, emoji: string | Emoji): Promise<void>;
|
|
2606
|
-
/**
|
|
2607
|
-
*
|
|
2608
|
-
* @param message The message to unreact. Can be a Message object or a message ID.
|
|
2609
|
-
* @param emoji the emoji to unreact with. Can be a string or an Emoji object.
|
|
2610
|
-
* @param user_id The user ID to remove the reaction for. If not provided, removes the reaction for the current user.
|
|
2611
|
-
* @param remove_all Whether to remove all of the specified reaction for the message. Defaults to false.
|
|
2612
|
-
* @returns Promise that resolves when the reaction is removed
|
|
2613
|
-
*/
|
|
2614
|
-
removeReaction(message: MessageResolvable | string, emoji: string | Emoji, user_id?: string, remove_all?: boolean): Promise<void>;
|
|
2615
|
-
/**
|
|
2616
|
-
* remove all reactions from a message
|
|
2617
|
-
* @param message The message to remove reactions from. Can be a Message object or a message ID.
|
|
2618
|
-
* @returns Promise that resolves when the reactions are removed
|
|
2619
|
-
*/
|
|
2620
|
-
removeAllReactions(message: MessageResolvable | string): Promise<void>;
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
3110
|
type RoleResolvable = Role | string;
|
|
2624
3111
|
declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
2625
3112
|
id: string;
|
|
@@ -2660,40 +3147,6 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2660
3147
|
edit(role: RoleResolvable, data: editableRole): Promise<Role>;
|
|
2661
3148
|
}
|
|
2662
3149
|
|
|
2663
|
-
type ServerChannelResolvable = ServerChannel | APIServerChannel | string;
|
|
2664
|
-
interface CreateChannelOptions {
|
|
2665
|
-
name: string;
|
|
2666
|
-
type?: "Text" | "Voice";
|
|
2667
|
-
description?: string;
|
|
2668
|
-
}
|
|
2669
|
-
declare class ServerChannelManager extends BaseManager<ServerChannel> {
|
|
2670
|
-
protected readonly server: Server;
|
|
2671
|
-
/** @private */
|
|
2672
|
-
holds: typeof ServerChannel;
|
|
2673
|
-
constructor(server: Server);
|
|
2674
|
-
/** @private */
|
|
2675
|
-
_add(data: APIServerChannel): ServerChannel;
|
|
2676
|
-
/**
|
|
2677
|
-
* Creates a new channel in the server.
|
|
2678
|
-
* @param options - Options for creating the channel.
|
|
2679
|
-
* @param options.name - The name of the channel to create.
|
|
2680
|
-
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
2681
|
-
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
2682
|
-
* @returns A promise that resolves to the created channel.
|
|
2683
|
-
*/
|
|
2684
|
-
create({ name, type, description, }: CreateChannelOptions): Promise<ServerChannel>;
|
|
2685
|
-
/**
|
|
2686
|
-
* fetch a channel from the server
|
|
2687
|
-
* @param channel The channel to fetch. Can be a string, a channel object, or an API channel object.
|
|
2688
|
-
* @param force Whether to force fetch the channel from the API. Defaults to true.
|
|
2689
|
-
* If set to false, the method will return the channel from the cache if it exists.
|
|
2690
|
-
* @returns A promise that resolves to the fetched channel
|
|
2691
|
-
*/
|
|
2692
|
-
fetch(channel: ServerChannelResolvable, { force }?: {
|
|
2693
|
-
force?: boolean | undefined;
|
|
2694
|
-
}): Promise<ServerChannel>;
|
|
2695
|
-
}
|
|
2696
|
-
|
|
2697
3150
|
type ServerMemberResolvable = ServerMember | User | Member | string;
|
|
2698
3151
|
interface EditServerMemberOptions {
|
|
2699
3152
|
nickname?: string;
|