feat: default select menu values (#9867)

* feat: default select menu values

* feat(Message): support

* fix: fix crashes when an array is supplied and remove assertion

* docs(transformResolved): `BaseChannel` is the correct type

* refactor: prefer assignment

* chore: export function again

* fix(Util): fix circular dependency

* refactor(MentionableSelectMenu): clone in method

* docs: remove semicolon

* feat(MentionableSelectMenu): add `addDefaultValues()`

* refactor: reduce overhead

* types: adjust `channel`

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
Jaw0r3k
2023-11-12 17:32:41 +01:00
committed by GitHub
parent b5e23ec2ec
commit 4ff3ea4a1b
10 changed files with 320 additions and 73 deletions

View File

@@ -586,9 +586,6 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
option: APIApplicationCommandOption,
resolved: APIApplicationCommandInteractionData['resolved'],
): CommandInteractionOption<Cached>;
private transformResolved(
resolved: APIApplicationCommandInteractionData['resolved'],
): CommandInteractionResolvedData<Cached>;
}
export class InteractionResponse<Cached extends boolean = boolean> {
@@ -2037,6 +2034,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
public stickers: Collection<Snowflake, Sticker>;
public position: number | null;
public roleSubscriptionData: RoleSubscriptionData | null;
public resolved: CommandInteractionResolvedData | null;
public system: boolean;
public get thread(): AnyThreadChannel | null;
public tts: boolean;
@@ -3223,6 +3221,10 @@ export function setPosition<T extends Channel | Role>(
reason?: string,
): Promise<{ id: Snowflake; position: number }[]>;
export function parseWebhookURL(url: string): WebhookClientDataIdWithToken | null;
export function transformResolved<Cached extends CacheType>(
supportingData: SupportingInteractionResolvedData,
data?: APIApplicationCommandInteractionData['resolved'],
): CommandInteractionResolvedData<Cached>;
export interface MappedComponentBuilderTypes {
[ComponentType.Button]: ButtonBuilder;
@@ -6363,6 +6365,12 @@ export interface StageInstanceEditOptions {
privacyLevel?: StageInstancePrivacyLevel;
}
export interface SupportingInteractionResolvedData {
client: Client;
guild?: Guild;
channel?: GuildTextBasedChannel;
}
export type SweeperKey = keyof SweeperDefinitions;
export type CollectionSweepFilter<K, V> = (value: V, key: K, collection: Collection<K, V>) => boolean;