fix: attachment types (#7478)

This commit is contained in:
Khafra
2022-02-17 11:45:42 -05:00
committed by GitHub
parent dee27db35a
commit 395a68ff49
2 changed files with 11 additions and 1 deletions

View File

@@ -810,6 +810,11 @@ export class CommandInteractionOptionResolver<Cached extends CacheType = CacheTy
public getMember(name: string): NonNullable<CommandInteractionOption<Cached>['member']> | null;
public getRole(name: string, required: true): NonNullable<CommandInteractionOption<Cached>['role']>;
public getRole(name: string, required?: boolean): NonNullable<CommandInteractionOption<Cached>['role']> | null;
public getAttachment(name: string, required: true): NonNullable<CommandInteractionOption<Cached>['attachment']>;
public getAttachment(
name: string,
required?: boolean,
): NonNullable<CommandInteractionOption<Cached>['attachment']> | null;
public getMentionable(
name: string,
required: true,
@@ -3719,7 +3724,7 @@ export interface CommandInteractionOption<Cached extends CacheType = CacheType>
member?: CacheTypeReducer<Cached, GuildMember, APIInteractionDataResolvedGuildMember>;
channel?: CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>;
role?: CacheTypeReducer<Cached, Role, APIRole>;
attachment?: Collection<Snowflake, MessageAttachment>;
attachment?: MessageAttachment;
message?: GuildCacheMessage<Cached>;
}

View File

@@ -1307,3 +1307,8 @@ const selectMenu = new SelectMenuComponent({
new ActionRow({
components: [selectMenu.toJSON(), button.toJSON()],
});
declare const chatInputInteraction: ChatInputCommandInteraction;
expectType<MessageAttachment>(chatInputInteraction.options.getAttachment('attachment', true));
expectType<MessageAttachment | null>(chatInputInteraction.options.getAttachment('attachment'));