chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
@@ -0,0 +1,9 @@
import { createChannelWrapper } from '@botpress/common'
import { TrelloClient } from 'src/trello-api/trello-client'
import * as bp from '.botpress'
export const wrapChannel = createChannelWrapper<bp.IntegrationProps>()({
toolFactories: {
trelloClient: ({ ctx }) => new TrelloClient({ ctx }),
},
})
@@ -0,0 +1,10 @@
import { CardCommentPublisher } from './publishers/card-comments'
import * as bp from '.botpress'
export const channels = {
cardComments: {
messages: {
text: CardCommentPublisher.publishTextMessage,
},
},
} as const satisfies bp.IntegrationProps['channels']
@@ -0,0 +1,27 @@
import * as sdk from '@botpress/sdk'
import { wrapChannel } from '../channel-wrapper'
export namespace CardCommentPublisher {
export const publishTextMessage = wrapChannel(
{ channelName: 'cardComments', messageType: 'text' },
async ({ trelloClient, conversation, ack, payload, client }) => {
if (!conversation.tags.cardId) {
throw new sdk.RuntimeError('Card id must be set')
}
const commentId = await trelloClient.addCardComment({
cardId: conversation.tags.cardId,
commentBody: payload.text,
})
await client.updateConversation({
id: conversation.id,
tags: {
lastCommentId: commentId,
},
})
await ack({ tags: { commentId } })
}
)
}