Skip to content

Commit

Permalink
fix(CommandInteraction): cmds with no options throw error (#5734)
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Jun 3, 2021
1 parent fdad140 commit af2fad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/structures/CommandInteraction.js
Expand Up @@ -261,6 +261,7 @@ class CommandInteraction extends Interaction {
*/
_createOptionsCollection(options, resolved) {
const optionsCollection = new Collection();
if (typeof options === 'undefined') return optionsCollection;
for (const option of options) {
optionsCollection.set(option.name, this.transformOption(option, resolved));
}
Expand Down
10 changes: 3 additions & 7 deletions typings/index.d.ts
Expand Up @@ -1184,9 +1184,7 @@ declare module 'discord.js' {
options?: ReactionCollectorOptions,
): ReactionCollector;
public delete(): Promise<Message>;
public edit(
content: string | null | MessageEditOptions | MessageEmbed | APIMessage,
): Promise<Message>;
public edit(content: string | null | MessageEditOptions | MessageEmbed | APIMessage): Promise<Message>;
public edit(content: string | null, options: MessageEditOptions | MessageEmbed): Promise<Message>;
public equals(message: Message, rawData: unknown): boolean;
public fetchReference(): Promise<Message>;
Expand Down Expand Up @@ -1971,9 +1969,7 @@ declare module 'discord.js' {
): Promise<RawMessage>;
public editMessage(message: MessageResolvable, options: WebhookEditMessageOptions): Promise<RawMessage>;
public fetchMessage(message: Snowflake, cache?: boolean): Promise<RawMessage>;
public send(
content: string | (WebhookMessageOptions & { split?: false }) | MessageAdditions,
): Promise<RawMessage>;
public send(content: string | (WebhookMessageOptions & { split?: false }) | MessageAdditions): Promise<RawMessage>;
public send(options: WebhookMessageOptions & { split: true | SplitOptions }): Promise<RawMessage[]>;
public send(options: WebhookMessageOptions | APIMessage): Promise<RawMessage | RawMessage[]>;
public send(
Expand Down Expand Up @@ -2761,7 +2757,7 @@ declare module 'discord.js' {
name: string;
type: ApplicationCommandOptionType;
value?: string | number | boolean;
options?: CommandInteractionOption[];
options?: Collection<string, CommandInteractionOption>;
user?: User;
member?: GuildMember | RawInteractionDataResolvedGuildMember;
channel?: GuildChannel | RawInteractionDataResolvedChannel;
Expand Down

0 comments on commit af2fad9

Please sign in to comment.