/** * Messages read from a chat platform. * * A `ChatMessage` has the same shape on every read path: inbound events, * `Chat.fetchMessage` and `Chat.history`. Its `text` is the platform's own * content string, verbatim, and its mentions are data with offsets into that * text. * * @stability unstable * @since 4.1.5 */ import * as Schema from "../Schema.ts"; /** * Schema for the author of a message. * * **Details** * * `name` is a best-effort display name: whatever the payload carries. There * is no lookup, so inbound messages and history can differ. Other bots' * messages are delivered with `isBot: true`; `isSelf` marks the bot's own. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const Author: Schema.Struct<{ readonly id: Schema.String; readonly name: Schema.optionalKey; readonly isBot: Schema.Boolean; readonly isSelf: Schema.Boolean; }>; /** * The author of a message. * * @stability unstable * @category models * @since 4.1.5 */ export type Author = typeof Author.Type; /** * Schema for a mention inside a message's text. * * **Details** * * `start` and `end` are offsets into `ChatMessage.text`, in UTF-16 code * units, so `text.slice(start, end)` is the platform's own token for the * mention. `id` is the platform id, or `here`, `channel` or `everyone` for * a broadcast. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const Mention: Schema.Struct<{ readonly kind: Schema.Literals; readonly id: Schema.String; readonly start: Schema.Int; readonly end: Schema.Int; readonly isSelf: Schema.Boolean; }>; /** * A mention inside a message's text. * * @stability unstable * @category models * @since 4.1.5 */ export type Mention = typeof Mention.Type; /** * Schema for a file attached to a message. * * **Gotchas** * * An attachment never carries a URL. `Chat.download` resolves the id again. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const Attachment: Schema.Struct<{ readonly id: Schema.String; readonly name: Schema.optionalKey; readonly contentType: Schema.optionalKey; readonly size: Schema.optionalKey; }>; /** * A file attached to a message. * * @stability unstable * @category models * @since 4.1.5 */ export type Attachment = typeof Attachment.Type; /** * Schema for the message a message replies to. * * **Details** * * - `authorId` is there when the platform says who wrote the message * replied to. Discord leaves it out once that message is deleted. * - `isSelf` says whether that author is the bot. An adapter sets it on * every message it reads that has an `authorId`. A write ignores both. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const ReplyTo: Schema.Struct<{ readonly messageId: Schema.String; readonly authorId: Schema.optionalKey; readonly isSelf: Schema.optionalKey; }>; /** * The message a message replies to. * * @stability unstable * @category models * @since 4.1.5 */ export type ReplyTo = typeof ReplyTo.Type; /** * Schema for a message read from a chat platform. * * **Details** * * - `thread` is the address the message was posted to, the same on every read * path. It never changes: a message a thread hangs off stays in the parent, * also once it has replies. `Chat.startThread(message.thread, message.id)` * is the way from such a message to its thread. * - `text` is the platform's own content string, verbatim, with mention tokens * and code fences in place. One exception: Slack renders the bot's own * messages with `rich_text` blocks from those blocks as Markdown. * - `raw` is the platform's message payload, as a JSON value. * * **Gotchas** * * `text` is a different format from outbound Markdown and cannot be posted * back as is. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const ChatMessage: Schema.Struct<{ readonly id: Schema.String; readonly thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; readonly author: Schema.Struct<{ readonly id: Schema.String; readonly name: Schema.optionalKey; readonly isBot: Schema.Boolean; readonly isSelf: Schema.Boolean; }>; /** The platform's content verbatim, except Slack renders the bot's own rich_text blocks as Markdown. */ readonly text: Schema.String; readonly mentions: Schema.$Array; readonly id: Schema.String; readonly start: Schema.Int; readonly end: Schema.Int; readonly isSelf: Schema.Boolean; }>>; readonly replyTo: Schema.optionalKey; readonly isSelf: Schema.optionalKey; }>>; readonly attachments: Schema.$Array; readonly contentType: Schema.optionalKey; readonly size: Schema.optionalKey; }>>; readonly timestamp: Schema.DateTimeUtc; readonly raw: Schema.Codec; }>; /** * A message read from a chat platform. * * @stability unstable * @category models * @since 4.1.5 */ export type ChatMessage = typeof ChatMessage.Type; /** * Returns whether the message mentions the bot. * * **Gotchas** * * A reply to the bot is not a mention. Whether it counts as one is the * consumer's policy. * * @see {@link repliesToSelf} for a reply to one of the bot's messages * * @stability unstable * @category predicates * @since 4.1.5 */ export declare const mentionsSelf: (message: ChatMessage) => boolean; /** * Returns whether the message replies to one of the bot's own messages. * * **When to use** * * Use with `mentionsSelf` when a reply to the bot should count as addressed * to it, whether or not the reply pings. * * **Gotchas** * * - It reads `replyTo.isSelf`, so it is false when the platform does not say * who wrote the message replied to. * - A message in a Slack thread is not a reply to the thread's first * message: Slack messages carry no `replyTo`. * * @see {@link mentionsSelf} for a mention of the bot * * @stability unstable * @category predicates * @since 4.1.5 */ export declare const repliesToSelf: (message: ChatMessage) => boolean; //# sourceMappingURL=ChatMessage.d.ts.map