(options: {
readonly click?: Effect.Effect<ChatInteraction.ClickReply>
readonly submit?: Effect.Effect<ChatInteraction.SubmitReply>
readonly command?: (command: ChatInteraction.CommandInvoked) => ChatInteraction.CommandReply
readonly refused?: (error: ChatError.ChatError) => Effect.Effect<void>
})
| 14 | ChatInteraction.CommandInvoked.make({ id, text, thread, userId: "u1", raw: { id: "i1" } }) |
| 15 | |
| 16 | const handlerWith = (options: { |
| 17 | readonly click?: Effect.Effect<ChatInteraction.ClickReply> |
| 18 | readonly submit?: Effect.Effect<ChatInteraction.SubmitReply> |
| 19 | readonly command?: (command: ChatInteraction.CommandInvoked) => ChatInteraction.CommandReply |
| 20 | readonly refused?: (error: ChatError.ChatError) => Effect.Effect<void> |
| 21 | }) => |
| 22 | ChatInteraction.Handler.of({ |
| 23 | click: () => options.click ?? Effect.succeed(ChatInteraction.ack), |
| 24 | submit: () => options.submit ?? Effect.succeed(ChatInteraction.close), |
| 25 | command: (command) => Effect.succeed(options.command?.(command) ?? ChatInteraction.ack), |
| 26 | refused: (_, error) => options.refused?.(error) ?? Effect.void |
| 27 | }) |
| 28 | |
| 29 | describe("ChatInteraction", () => { |
| 30 | it("encodes a value by its schema: a string-only schema as it is, anything else as JSON", () => { |
no test coverage detected