Skip to content

Commit 0973bfa

Browse files
update src/structures/CommandContext.ts
1 parent 6179da0 commit 0973bfa

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/structures/CommandContext.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,25 @@ export default class CommandContext {
2929
opts: BaseMessageOptions | InteractionReplyOptions,
3030
): Promise<unknown> {
3131
if (this.interaction instanceof ChatInputCommandInteraction) {
32+
const safeOptions = { ...opts };
33+
delete (safeOptions as any).flags;
34+
3235
if (this.interaction.replied) {
33-
return this.interaction.followUp(
34-
Object.assign(opts, {
35-
withResponse: true,
36-
}) as InteractionReplyOptions,
37-
);
36+
return this.interaction.followUp(safeOptions as InteractionReplyOptions);
3837
}
38+
3939
if (this.interaction.deferred) {
40-
// @ts-ignore
41-
return this.interaction.editReply(
42-
Object.assign(opts, {
43-
withResponse: true,
44-
}) as InteractionReplyOptions,
45-
);
40+
return this.interaction.editReply(safeOptions as InteractionEditReplyOptions);
4641
}
47-
return this.interaction.reply(
48-
Object.assign(opts, { withResponse: true }) as InteractionReplyOptions,
49-
);
42+
43+
return this.interaction.reply(opts as InteractionReplyOptions);
5044
}
45+
5146
if (this.interaction instanceof Message) {
5247
return this.interaction.reply(opts as BaseMessageOptions);
5348
}
49+
50+
return Promise.reject(new Error("Unsupported interaction type"));
5451
}
5552

5653
public get subCommand(): string | boolean {

0 commit comments

Comments
 (0)