Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
fix(CommandContext): message context not replied
Browse files Browse the repository at this point in the history
  • Loading branch information
Mednoob committed Mar 10, 2023
1 parent 8f72a55 commit b4e12b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/structures/CommandContext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition, no-nested-ternary */
import { MessageInteractionAction } from "../typings";
import { ActionRowBuilder, BaseInteraction, BaseMessageOptions, ButtonBuilder, ButtonInteraction, ButtonStyle, ChatInputCommandInteraction, Collection, CommandInteraction, ContextMenuCommandInteraction, GuildMember, Interaction, InteractionReplyOptions, InteractionResponse, Message, MessageComponentInteraction, MessageMentions, MessagePayload, ModalSubmitFields, ModalSubmitInteraction, StringSelectMenuInteraction, TextBasedChannel, User } from "discord.js";
import { ActionRowBuilder, BaseInteraction, BaseMessageOptions, ButtonBuilder, ButtonInteraction, ButtonStyle, ChatInputCommandInteraction, Collection, CommandInteraction, ContextMenuCommandInteraction, GuildMember, Interaction, InteractionReplyOptions, InteractionResponse, Message, MessageComponentInteraction, MessageMentions, MessagePayload, MessageReplyOptions, ModalSubmitFields, ModalSubmitInteraction, StringSelectMenuInteraction, TextBasedChannel, User } from "discord.js";

export class CommandContext {
public additionalArgs = new Collection<string, any>();
Expand Down Expand Up @@ -96,7 +96,12 @@ export class CommandContext {
if ((options as InteractionReplyOptions).ephemeral) {
throw new Error("Cannot send ephemeral message in a non-interaction context.");
}
return this.context.channel!.send(options as BaseMessageOptions | MessagePayload | string);
if (typeof options === "string") {
options = { content: options };
}

((options as MessageReplyOptions).allowedMentions ??= {}).repliedUser = false;
return (this.context as Message).reply(options as MessageReplyOptions);
}

public isInteraction(): boolean {
Expand Down

0 comments on commit b4e12b5

Please sign in to comment.