/** * Inbound events from a chat platform. * * Adapters deliver a `ChatEvent` to the consumer's `ChatHandler`. Delivery is * at-least-once: `dedupeKey` gives two deliveries of one event the same key, * and the library keeps no seen-store. * * @stability unstable * @since 4.1.5 */ import * as Schema from "../Schema.ts"; /** * Schema for what an address turned out to be: a channel, a thread or a direct * conversation. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const ThreadKind: Schema.Literals; /** * What an address turned out to be: a channel, a thread or a direct * conversation. * * @stability unstable * @category models * @since 4.1.5 */ export type ThreadKind = typeof ThreadKind.Type; /** * Schema for a message that arrived in a thread. * * **Details** * * `thread` equals `message.thread`. `raw` is the delivery envelope; the * message payload is on `message.raw`. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const MessageCreated: Schema.Struct<{ readonly _tag: Schema.tag<"MessageCreated">; readonly thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; readonly kind: Schema.Literals; readonly message: 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; }>; 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; }>; readonly raw: Schema.Codec; }>; /** * A message that arrived in a thread. * * @stability unstable * @category models * @since 4.1.5 */ export type MessageCreated = typeof MessageCreated.Type; /** * Schema for a reaction a user added to a message. * * **Details** * * - `thread` is where the platform says it happened. On Slack this is the * channel, even for a message in a thread; `Chat.fetchMessage` returns the * message with its real address. * - `emoji` is a Unicode emoji, or `custom:{name}` for one the adapter's table * does not know. * - `messageAuthorId` and `timestamp` are missing when the platform does not * send them. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const ReactionAdded: Schema.Struct<{ readonly _tag: Schema.tag<"ReactionAdded">; thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; messageId: Schema.String; messageAuthorId: Schema.optionalKey; userId: Schema.String; emoji: Schema.String; timestamp: Schema.optionalKey; raw: Schema.Codec; }>; /** * A reaction a user added to a message. * * @stability unstable * @category models * @since 4.1.5 */ export type ReactionAdded = typeof ReactionAdded.Type; /** * Schema for a reaction a user removed from a message. * * **Details** * * The fields mean the same as on `ReactionAdded`. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const ReactionRemoved: Schema.Struct<{ readonly _tag: Schema.tag<"ReactionRemoved">; thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; messageId: Schema.String; messageAuthorId: Schema.optionalKey; userId: Schema.String; emoji: Schema.String; timestamp: Schema.optionalKey; raw: Schema.Codec; }>; /** * A reaction a user removed from a message. * * @stability unstable * @category models * @since 4.1.5 */ export type ReactionRemoved = typeof ReactionRemoved.Type; /** * Schema for a user asking the bot to stop working in a thread, as Slack's * stop button does. * * **Details** * * - Nothing has been stopped. The thread's streams stay open and keep taking * text until the consumer ends them, and the platform shows a disabled * button until then. * - `messageIds` holds the streams the platform named. It is empty when no * stream was open, but an empty list does not mean none is: Slack names * the stream only on the first click in a thread. End the thread's reply * whatever it holds. * - `id` is the platform's id for the request, Slack's `event_ts`. Two * deliveries of one request share it. * - It has no `kind`. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const StopRequested: Schema.Struct<{ readonly _tag: Schema.tag<"StopRequested">; readonly thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; readonly id: Schema.String; readonly userId: Schema.String; readonly messageIds: Schema.$Array; readonly raw: Schema.Codec; }>; /** * A user asking the bot to stop working in a thread. * * @stability unstable * @category models * @since 4.1.5 */ export type StopRequested = typeof StopRequested.Type; /** * Schema for an inbound chat event. * * **Gotchas** * * The union is open: later releases add members such as edits and deletes, so * a `switch` over `_tag` needs a `default`. * * @stability unstable * @category schemas * @since 4.1.5 */ export declare const ChatEvent: Schema.Union; readonly thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; readonly kind: Schema.Literals; readonly message: 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; }>; 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; }>; readonly raw: Schema.Codec; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ReactionAdded">; thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; messageId: Schema.String; messageAuthorId: Schema.optionalKey; userId: Schema.String; emoji: Schema.String; timestamp: Schema.optionalKey; raw: Schema.Codec; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ReactionRemoved">; thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; messageId: Schema.String; messageAuthorId: Schema.optionalKey; userId: Schema.String; emoji: Schema.String; timestamp: Schema.optionalKey; raw: Schema.Codec; }>, Schema.Struct<{ readonly _tag: Schema.tag<"StopRequested">; readonly thread: Schema.Struct<{ readonly platform: Schema.String; readonly id: Schema.String; }>; readonly id: Schema.String; readonly userId: Schema.String; readonly messageIds: Schema.$Array; readonly raw: Schema.Codec; }>]>; /** * An inbound chat event. * * @stability unstable * @category models * @since 4.1.5 */ export type ChatEvent = typeof ChatEvent.Type; /** * Returns the key two deliveries of one event share. * * **When to use** * * Use to drop redelivered events: delivery is at-least-once and the library * keeps no seen-store. * * **Details** * * - A message is `message/{thread}/{id}`, with the thread in its * `{platform}:{id}` form. * - A reaction is `reaction/{messageId}/{userId}/{emoji}/{added|removed}`. * - A stop request is `stop/{thread}/{id}`. * - Slack's `message` and `app_mention` for one message share a key. * * @stability unstable * @category getters * @since 4.1.5 */ export declare const dedupeKey: (event: ChatEvent) => string; //# sourceMappingURL=ChatEvent.d.ts.map