Skip to content

Commit

Permalink
chore(builders): add attachment option tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amitojsingh366 authored and iCrawl committed Feb 13, 2022
1 parent de84599 commit 8bee4ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SlashCommandMentionableOption,
SlashCommandNumberOption,
SlashCommandRoleOption,
SlashCommandAttachmentOption,
SlashCommandStringOption,
SlashCommandSubcommandBuilder,
SlashCommandSubcommandGroupBuilder,
Expand All @@ -25,6 +26,7 @@ const getBooleanOption = () => new SlashCommandBooleanOption().setName('owo').se
const getUserOption = () => new SlashCommandUserOption().setName('owo').setDescription('Testing 123');
const getChannelOption = () => new SlashCommandChannelOption().setName('owo').setDescription('Testing 123');
const getRoleOption = () => new SlashCommandRoleOption().setName('owo').setDescription('Testing 123');
const getAttachmentOption = () => new SlashCommandAttachmentOption().setName('owo').setDescription('Testing 123');
const getMentionableOption = () => new SlashCommandMentionableOption().setName('owo').setDescription('Testing 123');
const getSubcommandGroup = () => new SlashCommandSubcommandGroupBuilder().setName('owo').setDescription('Testing 123');
const getSubcommand = () => new SlashCommandSubcommandBuilder().setName('owo').setDescription('Testing 123');
Expand Down Expand Up @@ -286,6 +288,8 @@ describe('Slash Commands', () => {

expect(() => getBuilder().addRoleOption(getRoleOption())).not.toThrowError();

expect(() => getBuilder().addAttachmentOption(getAttachmentOption())).not.toThrowError();

expect(() => getBuilder().addMentionableOption(getMentionableOption())).not.toThrowError();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
import { APIApplicationCommandAttachmentOption, ApplicationCommandOptionType } from 'discord-api-types/v9';
import { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase';

export class SlashCommandAttachmentOption extends SlashCommandOptionBase {
export class SlashCommandAttachmentOption extends ApplicationCommandOptionBase {
public override readonly type = ApplicationCommandOptionType.Attachment as const;

public constructor() {
super(ApplicationCommandOptionType.Attachment);
public toJSON(): APIApplicationCommandAttachmentOption {
this.runRequiredValidations();

return { ...this };
}
}
}

0 comments on commit 8bee4ff

Please sign in to comment.