Controller for message features.

Constructors

Methods

Constructors

Methods

  • Post a message to a channel.

    Parameters

    • channelId: string

      Channel ID to send message.

    • body: RESTPostAPIChannelMessageJSONBody

      Message contents, embeds, etc.

    Returns Promise<Result<RESTError | Error, APIMessage>>

    const result = await client.message.create("CHANNEL_ID", { content: "Hello, world!" });
    
  • Retrieve a message in a channel.

    Parameters

    • channelId: string

      Channel ID to get message.

    • messageId: string

      Message ID to get.

    Returns Promise<Result<RESTError | Error, APIMessage>>

    const result = await client.message.get("CHANNEL_ID", "MESSAGE_ID");
    
  • Retrieve the messages in a channel.

    Parameters

    • channelId: string

      Channel ID to get messages.

    • Optionaloption: RESTGetAPIChannelMessagesQuery

      Query options to filter messages.

    Returns Promise<Result<RESTError | Error, RESTGetAPIChannelMessagesResult>>

    const result = await client.message.getMany("CHANNEL_ID", { limit: 10 });