huruhuru - v0.0.1
    Preparing search index...

    Class CommandContext<ContextBase>

    A thin wrapper that normalises common operations between interaction-based commands and message-based commands.

    Use this class when implementing commands to avoid branching on whether the caller is an interaction or a message.

    // Interaction
    const ctx = new CommandContext(interaction);
    await ctx.deferReply();
    await ctx.reply("Done");

    // Message
    const ctx2 = new CommandContext(message);
    await ctx2.reply("Hello from message");

    Type Parameters

    Index
    • get options(): | Omit<
          CommandInteractionOptionResolver<CacheType>,
          "getMessage" | "getFocused",
      >
      | undefined

      Returns
          | Omit<
              CommandInteractionOptionResolver<CacheType>,
              "getMessage" | "getFocused",
          >
          | undefined

    • Parameters

      • target: MessageResolvable = "@original"

      Returns Promise<void>

    • Parameters

      Returns Promise<Message<boolean>>

    • Parameters

      • this: CommandContext<Message<true>>
      • options: string | MessagePayload | InteractionEditReplyOptions

      Returns Promise<OmitPartialGroupDMChannel<Message<true>>>

    • Parameters

      • this: CommandContext<Message<false>>
      • options: string | MessagePayload | InteractionEditReplyOptions

      Returns Promise<OmitPartialGroupDMChannel<Message<false>>>

    • Parameters

      • this: CommandContext<Base>
      • options: string | MessagePayload | InteractionEditReplyOptions

      Returns Promise<Message<boolean>>

    • Parameters

      • target: string = "@original"

      Returns Promise<Message<boolean>>

    • Parameters

      Returns Promise<Message<true>>

    • Parameters

      Returns Promise<Message<false>>

    • Parameters

      • this: CommandContext<Message<true>>
      • options: string | MessagePayload | MessageReplyOptions

      Returns Promise<OmitPartialGroupDMChannel<Message<true>>>

    • Parameters

      • this: CommandContext<Message<false>>
      • options: string | MessagePayload | MessageReplyOptions

      Returns Promise<OmitPartialGroupDMChannel<Message<false>>>

    • Parameters

      • this: CommandContext<Base>
      • options: string | MessagePayload | InteractionReplyOptions | MessageReplyOptions

      Returns Promise<Message<boolean>>

    • Parameters

      Returns Promise<InteractionResponse<true>>

    • Parameters

      Returns Promise<InteractionResponse<false>>

    • Parameters

      • this: CommandContext<Message<true>>
      • options: string | MessagePayload | MessageReplyOptions

      Returns Promise<OmitPartialGroupDMChannel<Message<true>>>

    • Parameters

      • this: CommandContext<Message<false>>
      • options: string | MessagePayload | MessageReplyOptions

      Returns Promise<OmitPartialGroupDMChannel<Message<false>>>

    • Parameters

      • this: CommandContext<Base>
      • options: string | MessagePayload | InteractionReplyOptions | MessageReplyOptions

      Returns Promise<
          | InteractionResponse<boolean>
          | OmitPartialGroupDMChannel<Message<boolean>>,
      >