mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
* feat: message structures * fix: docs * chore: components and more * feat: embed and more * feat: more substructures and code review suggestions * chore: tests and date conversions * chore: jsdoc strings * fix: tests * fix: tests * feat: hexColor getters * chore: remove getters for nested data * chore: apply suggestions from code review * fix: burst_colors in toJSON * docs: rephrase SectionBuilder remark * chore: add LabelComponent * fix: add name and size to file component * chore: move resolved interaction data to interactions dir * fix: code review * chore: bump discord-api-types * chore: apply code review suggestions * fix: lockfile * chore: update remark * fix: missing export * chore: code review and tests * build: fix file * fix: typo * fix: missing toJSON * fix: remove redundant patch overrides * chore: missing component suffix * chore: better name * chore: add comment explaining timestamp conversion --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import type { APIChannelSelectComponent, ChannelType } from 'discord-api-types/v10';
|
|
import { kData } from '../../utils/symbols.js';
|
|
import type { Partialize } from '../../utils/types.js';
|
|
import { SelectMenuComponent } from './SelectMenuComponent.js';
|
|
|
|
/**
|
|
* Represents a channel select menu component.
|
|
*
|
|
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
|
|
* @remarks has `SelectMenuDefaultValue`s as substructures which need to be instantiated and stored by an extending class using it
|
|
*/
|
|
export class ChannelSelectMenuComponent<
|
|
Omitted extends keyof APIChannelSelectComponent | '' = '',
|
|
> extends SelectMenuComponent<APIChannelSelectComponent, Omitted> {
|
|
/**
|
|
* The template used for removing data from the raw data stored for each ChannelSelectMenuComponent.
|
|
*/
|
|
public static override readonly DataTemplate: Partial<APIChannelSelectComponent> = {};
|
|
|
|
/**
|
|
* @param data - The raw data received from the API for the channel select menu
|
|
*/
|
|
public constructor(data: Partialize<APIChannelSelectComponent, Omitted>) {
|
|
super(data);
|
|
}
|
|
|
|
/**
|
|
* The list of channel types to include in the channel select component
|
|
*/
|
|
public get channelTypes() {
|
|
return Array.isArray(this[kData].channel_types) ? (this[kData].channel_types as readonly ChannelType[]) : null;
|
|
}
|
|
}
|