chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
export const actions = {
|
||||
startDmConversationFromComment: {
|
||||
title: 'Start DM Conversation from Comment',
|
||||
description: 'Start a DM conversation from a comment',
|
||||
input: {
|
||||
schema: sdk.z.object({
|
||||
commentId: sdk.z.string().title('Comment ID').describe('The ID of the comment to start the conversation from'),
|
||||
message: sdk.z.string().title('Message').describe('The message to send to the user'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: sdk.z.object({}),
|
||||
},
|
||||
},
|
||||
} as const satisfies sdk.IntegrationDefinitionProps['actions']
|
||||
@@ -0,0 +1,30 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
const commentIdSchema = z.object({
|
||||
commentId: z
|
||||
.string()
|
||||
.optional()
|
||||
.title('Comment ID')
|
||||
.describe('The Messenger ID of the comment from which to initiate the next private-reply discussion'),
|
||||
})
|
||||
|
||||
export const messages = {
|
||||
text: { schema: sdk.messages.defaults.text.schema.merge(commentIdSchema) },
|
||||
image: { schema: sdk.messages.defaults.image.schema.merge(commentIdSchema) },
|
||||
audio: { schema: sdk.messages.defaults.audio.schema.merge(commentIdSchema) },
|
||||
video: { schema: sdk.messages.defaults.video.schema.merge(commentIdSchema) },
|
||||
file: { schema: sdk.messages.defaults.file.schema.merge(commentIdSchema) },
|
||||
location: { schema: sdk.messages.defaults.location.schema.merge(commentIdSchema) },
|
||||
carousel: { schema: sdk.messages.defaults.carousel.schema.merge(commentIdSchema) },
|
||||
card: { schema: sdk.messages.defaults.card.schema.merge(commentIdSchema) },
|
||||
dropdown: { schema: sdk.messages.defaults.dropdown.schema.merge(commentIdSchema) },
|
||||
choice: { schema: sdk.messages.defaults.choice.schema.merge(commentIdSchema) },
|
||||
bloc: { schema: sdk.messages.markdownBloc.schema.merge(commentIdSchema) },
|
||||
} as const satisfies Record<string, { schema: z.ZodTypeAny }>
|
||||
|
||||
type ValueOf<T> = T[keyof T]
|
||||
type ChannelMessageDefinition = ValueOf<typeof messages>
|
||||
type ChannelMessage = sdk.z.infer<ChannelMessageDefinition['schema']>
|
||||
type AssertMessageTypeHasCommentId<_T extends z.infer<typeof commentIdSchema>> = true
|
||||
type _AssertMessageTypesHaveCommentId = AssertMessageTypeHasCommentId<ChannelMessage>
|
||||
Reference in New Issue
Block a user