/** * The service a consumer provides to receive chat events. * * Adapters take the `ChatHandler` service from context and call `handle` for * every inbound event. The contract is "accept, fast": success means the event * is the consumer's. The platform can still deliver it again, so drop * repeats with `ChatEvent.dedupeKey`. * * @stability unstable * @since 4.1.5 */ import * as Context from "../Context.ts"; import * as Effect from "../Effect.ts"; import * as Layer from "../Layer.ts"; import * as Schema from "../Schema.ts"; import type * as Scope from "../Scope.ts"; import type { ChatEvent } from "./ChatEvent.ts"; declare const NotAccepted_base: Schema.Class, import("../Cause.ts").YieldableError>; /** * Error for an event that was not accepted. * * **Details** * * A handler fails with it to refuse an event, and an adapter's entry point * fails with it when it could not finish normalising one. Slack answers 503 so * the event is redelivered; the Discord gateway layer drops it. * * **Gotchas** * * It has no fields, so whoever raises it logs the reason first. * * @stability unstable * @category errors * @since 4.1.5 */ export declare class NotAccepted extends NotAccepted_base { } declare const ChatHandler_base: Context.ServiceClass Effect.Effect; }>; /** * Service that receives inbound chat events, provided by the consumer. * * **Details** * * Adapters take the service and call `handle`. Success hands the event to the * consumer, and `NotAccepted` refuses it. Success does not stop the platform * from delivering the event again: delivery is at-least-once. * * **Gotchas** * * Forking the work and returning loses events on a crash. How durable an * accepted event is belongs to the consumer. * * @see {@link layer} for the only constructor * * @stability unstable * @category services * @since 4.1.5 */ export declare class ChatHandler extends ChatHandler_base { } /** * Creates the `ChatHandler` layer from a function that handles one event. * * **Details** * * - The bot's own messages are dropped before `handle` runs, unless * `deliverSelf` is `true`. Other bots' messages are delivered, flagged with * `author.isBot`. * - Every event runs in a `ChatHandler.handle` span and its own `Scope`. * * @stability unstable * @category layers * @since 4.1.5 */ export declare const layer: (handle: (event: ChatEvent) => Effect.Effect, options?: { readonly deliverSelf?: boolean | undefined; }) => Layer.Layer>; export {}; //# sourceMappingURL=ChatHandler.d.ts.map