Class

MessageManager

Per-channel message cache + fetch. Access via `channel.messages`. `fetch` always writes through the client message cache (when enabled) and constructs Message from the cached payload so `get` stays coherent.

Constructor

new MessageManager(client: Client, channelId: string)
ParamTypeDescription
clientClient
channelIdstring

Methods

fetch(messageId: string): Promise<Message>

Fetch a single message by ID.

ParamTypeDescription
messageIdstring
fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>

Fetch multiple messages with query options (limit, before, after, around).

ParamTypeDescription
optionsFetchMessagesOptions
fetch(idOrOptions: string | FetchMessagesOptions): Promise<Message | Collection<string, Message>>
ParamTypeDescription
idOrOptionsstring | FetchMessagesOptions
fetchMany(options: FetchMessagesOptions): Promise<Collection<string, Message>>

Fetch multiple messages from the API with pagination/filtering.

ParamTypeDescription
optionsFetchMessagesOptions
fetchOne(messageId: string): Promise<Message>

Fetch a single message from the API.

ParamTypeDescription
messageIdstring
get(messageId: string): Message | undefined

Retrieve a cached message by ID, or `undefined` if missing / caching disabled.

ParamTypeDescription
messageIdstring
wrap(data: APIMessage): Message

Cache API data and return a Message built from the cached entry when present.

ParamTypeDescription
dataAPIMessage