diff --git a/src/mixins/message-mixin.ts b/src/mixins/message-mixin.ts index 8cae91d3..4204c267 100644 --- a/src/mixins/message-mixin.ts +++ b/src/mixins/message-mixin.ts @@ -37,6 +37,7 @@ import { type SayablePayload, sayableTypes, } from '../schemas/sayable.js' +import type { ChannelPayload } from '../schemas/channel.js' const filebox = (filebox: string | FileBoxInterface) => typeof filebox === 'string' ? FileBox.fromJSON(filebox) : filebox @@ -67,6 +68,7 @@ const messageMixin = (bas abstract messageMiniProgram (messageId: string) : Promise abstract messageUrl (messageId: string) : Promise abstract messageLocation (messageId: string) : Promise + abstract messageChannel (messageId: string) : Promise abstract messageForward (conversationId: string, messageId: string,) : Promise abstract messageSendContact (conversationId: string, contactId: string) : Promise @@ -76,6 +78,7 @@ const messageMixin = (bas abstract messageSendPost (conversationId: string, postPayload: PostPayload) : Promise abstract messageSendText (conversationId: string, text: string, mentionIdList?: string[]) : Promise abstract messageSendUrl (conversationId: string, urlLinkPayload: UrlLinkPayload) : Promise + abstract messageSendChannel (conversationId: string, channelPayload: ChannelPayload) : Promise abstract messageRecall (messageId: string) : Promise @@ -280,6 +283,8 @@ const messageMixin = (bas return this.messageSendText(conversationId, sayable.payload.text, sayable.payload.mentions) case sayableTypes.Post: return this.messageSendPost(conversationId, sayable.payload) + case sayableTypes.Channel: + return this.messageSendChannel(conversationId, sayable.payload) default: throw new Error('unsupported sayable payload: ' + JSON.stringify(sayable)) } diff --git a/src/mixins/sayable-mixin.ts b/src/mixins/sayable-mixin.ts index 97f5faf3..dc985227 100644 --- a/src/mixins/sayable-mixin.ts +++ b/src/mixins/sayable-mixin.ts @@ -60,6 +60,10 @@ const sayableMixin = ({ ...loc const payloadMiniProgram = (miniProgramPayload: MiniProgramPayload) => ({ ...miniProgramPayload }) const payloadUrlLink = (urlLinkPayload: UrlLinkPayload) => ({ ...urlLinkPayload }) const payloadPost = (postPayload: PostPayload) => ({ ...postPayload }) +const payloadChannel = (channelPayload: ChannelPayload) => ({ ...channelPayload }) /** * using `types` as a static typed string name list for `createAction` @@ -61,6 +63,7 @@ const location = createAction(sayableTypes.Location, payloadLocation)() const miniProgram = createAction(sayableTypes.MiniProgram, payloadMiniProgram)() const url = createAction(sayableTypes.Url, payloadUrlLink)() const post = createAction(sayableTypes.Post, payloadPost)() +const channel = createAction(sayableTypes.Channel, payloadChannel)() /** * Huan(202201): Recursive type references @@ -77,6 +80,7 @@ const sayablePayloadsNoPost = { text, url, video, + channel, } as const /**