test
This commit is contained in:
@@ -285,6 +285,6 @@
|
|||||||
"message": "Import setImmediate from `node:timers` instead"
|
"message": "Import setImmediate from `node:timers` instead"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"linebreak-style": "off"
|
"linebreak-style": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ const MessageFlags = require('../util/MessageFlags');
|
|||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||||
const Util = require('../util/Util');
|
const Util = require('../util/Util');
|
||||||
|
const ContainerComponent = require('./ContainerComponent');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {WeakSet<Message>}
|
* @type {WeakSet<Message>}
|
||||||
@@ -162,8 +163,8 @@ class Message extends Base {
|
|||||||
|
|
||||||
if ('components' in data) {
|
if ('components' in data) {
|
||||||
/**
|
/**
|
||||||
* A list of MessageActionRows in the message
|
* A list of components in the message
|
||||||
* @type {MessageActionRow[]}
|
* @type {MessageActionRow[] | ContainerComponent[]}
|
||||||
*/
|
*/
|
||||||
this.components = data.components.map(c => BaseMessageComponent.create(c, this.client));
|
this.components = data.components.map(c => BaseMessageComponent.create(c, this.client));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
11
typings/enums.d.ts
vendored
11
typings/enums.d.ts
vendored
@@ -235,6 +235,17 @@ export const enum MessageComponentTypes {
|
|||||||
CONTAINER = 17,
|
CONTAINER = 17,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const enum MessageComponentInteractables {
|
||||||
|
ACTION_ROW = 1,
|
||||||
|
BUTTON = 2,
|
||||||
|
STRING_SELECT = 3,
|
||||||
|
TEXT_INPUT = 4,
|
||||||
|
USER_SELECT = 5,
|
||||||
|
ROLE_SELECT = 6,
|
||||||
|
MENTIONABLE_SELECT = 7,
|
||||||
|
CHANNEL_SELECT = 8,
|
||||||
|
}
|
||||||
|
|
||||||
export const enum SelectMenuComponentTypes {
|
export const enum SelectMenuComponentTypes {
|
||||||
STRING_SELECT = 3,
|
STRING_SELECT = 3,
|
||||||
USER_SELECT = 5,
|
USER_SELECT = 5,
|
||||||
|
|||||||
49
typings/index.d.ts
vendored
49
typings/index.d.ts
vendored
@@ -92,6 +92,7 @@ import {
|
|||||||
MembershipStates,
|
MembershipStates,
|
||||||
MessageButtonStyles,
|
MessageButtonStyles,
|
||||||
MessageComponentTypes,
|
MessageComponentTypes,
|
||||||
|
MessageComponentInteractables,
|
||||||
MessageTypes,
|
MessageTypes,
|
||||||
MFALevels,
|
MFALevels,
|
||||||
NSFWLevels,
|
NSFWLevels,
|
||||||
@@ -1604,8 +1605,8 @@ export class GuildAuditLogsEntry<
|
|||||||
TAction = TActionRaw extends keyof GuildAuditLogsIds
|
TAction = TActionRaw extends keyof GuildAuditLogsIds
|
||||||
? GuildAuditLogsIds[TActionRaw]
|
? GuildAuditLogsIds[TActionRaw]
|
||||||
: TActionRaw extends null
|
: TActionRaw extends null
|
||||||
? 'ALL'
|
? 'ALL'
|
||||||
: TActionRaw,
|
: TActionRaw,
|
||||||
TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes
|
TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes
|
||||||
? GuildAuditLogsTypes[TAction][1]
|
? GuildAuditLogsTypes[TAction][1]
|
||||||
: 'ALL',
|
: 'ALL',
|
||||||
@@ -1952,10 +1953,10 @@ export type CacheTypeReducer<
|
|||||||
> = [State] extends ['cached']
|
> = [State] extends ['cached']
|
||||||
? CachedType
|
? CachedType
|
||||||
: [State] extends ['raw']
|
: [State] extends ['raw']
|
||||||
? RawType
|
? RawType
|
||||||
: [State] extends ['raw' | 'cached']
|
: [State] extends ['raw' | 'cached']
|
||||||
? PresentType
|
? PresentType
|
||||||
: Fallback;
|
: Fallback;
|
||||||
|
|
||||||
export class Interaction<Cached extends CacheType = CacheType> extends Base {
|
export class Interaction<Cached extends CacheType = CacheType> extends Base {
|
||||||
// This a technique used to brand different cached types. Or else we'll get `never` errors on typeguard checks.
|
// This a technique used to brand different cached types. Or else we'll get `never` errors on typeguard checks.
|
||||||
@@ -2132,7 +2133,7 @@ export interface StringMappedInteractionTypes<Cached extends CacheType = CacheTy
|
|||||||
export type WrapBooleanCache<T extends boolean> = If<T, 'cached', CacheType>;
|
export type WrapBooleanCache<T extends boolean> = If<T, 'cached', CacheType>;
|
||||||
|
|
||||||
export type MappedInteractionTypes<Cached extends boolean = boolean> = EnumValueMapped<
|
export type MappedInteractionTypes<Cached extends boolean = boolean> = EnumValueMapped<
|
||||||
typeof MessageComponentTypes,
|
typeof MessageComponentInteractables,
|
||||||
{
|
{
|
||||||
BUTTON: ButtonInteraction<WrapBooleanCache<Cached>>;
|
BUTTON: ButtonInteraction<WrapBooleanCache<Cached>>;
|
||||||
STRING_SELECT: StringSelectInteraction<WrapBooleanCache<Cached>>;
|
STRING_SELECT: StringSelectInteraction<WrapBooleanCache<Cached>>;
|
||||||
@@ -2327,7 +2328,7 @@ export class MediaGalleryComponent extends BaseMessageComponent {
|
|||||||
public constructor(data?: MediaGalleryComponent | APIMediaGalleryComponent);
|
public constructor(data?: MediaGalleryComponent | APIMediaGalleryComponent);
|
||||||
public items: MediaGalleryItem[];
|
public items: MediaGalleryItem[];
|
||||||
public toJSON(): APIMediaGalleryComponent;
|
public toJSON(): APIMediaGalleryComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileComponent extends BaseMessageComponent {
|
export class FileComponent extends BaseMessageComponent {
|
||||||
public constructor(data?: FileComponent | APIFileComponent);
|
public constructor(data?: FileComponent | APIFileComponent);
|
||||||
@@ -2365,7 +2366,13 @@ export class SectionComponent<T extends ThumbnailComponent | MessageButton> exte
|
|||||||
|
|
||||||
export class ContainerComponent<
|
export class ContainerComponent<
|
||||||
U extends ThumbnailComponent | MessageButton,
|
U extends ThumbnailComponent | MessageButton,
|
||||||
T extends MessageActionRow | TextDisplayComponent | SectionComponent<U> | MediaGalleryComponent | SeparatorComponent | FileComponent
|
T extends
|
||||||
|
| MessageActionRow
|
||||||
|
| TextDisplayComponent
|
||||||
|
| SectionComponent<U>
|
||||||
|
| MediaGalleryComponent
|
||||||
|
| SeparatorComponent
|
||||||
|
| FileComponent,
|
||||||
> extends BaseMessageComponent {
|
> extends BaseMessageComponent {
|
||||||
public constructor(data?: ContainerComponent<U, T> | APIContainerComponent);
|
public constructor(data?: ContainerComponent<U, T> | APIContainerComponent);
|
||||||
public components: T[];
|
public components: T[];
|
||||||
@@ -6908,8 +6915,8 @@ export type GuildScheduledEventResolvable = Snowflake | GuildScheduledEvent;
|
|||||||
export type GuildScheduledEventSetStatusArg<T extends GuildScheduledEventStatus> = T extends 'SCHEDULED'
|
export type GuildScheduledEventSetStatusArg<T extends GuildScheduledEventStatus> = T extends 'SCHEDULED'
|
||||||
? 'ACTIVE' | 'CANCELED'
|
? 'ACTIVE' | 'CANCELED'
|
||||||
: T extends 'ACTIVE'
|
: T extends 'ACTIVE'
|
||||||
? 'COMPLETED'
|
? 'COMPLETED'
|
||||||
: never;
|
: never;
|
||||||
|
|
||||||
export type GuildScheduledEventStatus = keyof typeof GuildScheduledEventStatuses;
|
export type GuildScheduledEventStatus = keyof typeof GuildScheduledEventStatuses;
|
||||||
|
|
||||||
@@ -7152,9 +7159,9 @@ export type MessageComponentOptions =
|
|||||||
| MessageButtonOptions
|
| MessageButtonOptions
|
||||||
| MessageSelectMenuOptions;
|
| MessageSelectMenuOptions;
|
||||||
|
|
||||||
export type MessageComponentType = keyof typeof MessageComponentTypes;
|
export type MessageComponentType = keyof typeof MessageComponentInteractables;
|
||||||
|
|
||||||
export type MessageComponentTypeResolvable = MessageComponentType | MessageComponentTypes;
|
export type MessageComponentTypeResolvable = MessageComponentType | MessageComponentInteractables;
|
||||||
|
|
||||||
export type GuildForumThreadMessageCreateOptions = Omit<MessageOptions, 'poll'> &
|
export type GuildForumThreadMessageCreateOptions = Omit<MessageOptions, 'poll'> &
|
||||||
Pick<MessageOptions, 'flags' | 'stickers'>;
|
Pick<MessageOptions, 'flags' | 'stickers'>;
|
||||||
@@ -8059,14 +8066,14 @@ export type WSEventType =
|
|||||||
export type Serialized<T> = T extends symbol | bigint | (() => any)
|
export type Serialized<T> = T extends symbol | bigint | (() => any)
|
||||||
? never
|
? never
|
||||||
: T extends number | string | boolean | undefined
|
: T extends number | string | boolean | undefined
|
||||||
? T
|
? T
|
||||||
: T extends { toJSON(): infer R }
|
: T extends { toJSON(): infer R }
|
||||||
? R
|
? R
|
||||||
: T extends ReadonlyArray<infer V>
|
: T extends ReadonlyArray<infer V>
|
||||||
? Serialized<V>[]
|
? Serialized<V>[]
|
||||||
: T extends ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>
|
: T extends ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>
|
||||||
? {}
|
? {}
|
||||||
: { [K in keyof T]: Serialized<T[K]> };
|
: { [K in keyof T]: Serialized<T[K]> };
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user