Commit ca6a8697 authored by nanahira's avatar nanahira

more receive segments

parent 1e1b5509
......@@ -52,6 +52,21 @@ export interface WecomPicBody extends WecomMediaBody {
PicUrl: string;
}
export interface WecomVoiceBody extends WecomMediaBody {
Format: string;
}
export interface WecomVideoBody extends WecomMediaBody {
ThumbMediaId: number;
}
export interface WecomLocationMessageBody extends WecomEventBody {
Location_X: number;
Location_Y: number;
Scale: number;
Label: string;
}
export interface WecomLinkBody extends WecomEventBody {
Title: string;
Description: string;
......
......@@ -5,9 +5,12 @@ import {
WecomEventResponse,
WecomLinkBody,
WecomLocationBody,
WecomLocationMessageBody,
WecomPicBody,
WecomResponse,
WeComUser,
WecomVideoBody,
WecomVoiceBody,
} from './def';
export interface AdapterConfig {
......@@ -70,6 +73,30 @@ export function adaptSession(bot: WeComBot, input: WecomEventResponse) {
case 'link':
const linkBody = body as WecomLinkBody;
session.content = linkBody.Url;
break;
case 'video':
const videoBody = body as WecomVideoBody;
session.content = segment('wecom:video', {
mediaId: videoBody.MediaId,
thumbMediaId: videoBody.ThumbMediaId,
});
break;
case 'voice':
const voiceBody = body as WecomVoiceBody;
session.content = segment('voice', {
mediaId: voiceBody.MediaId,
format: voiceBody.Format,
});
break;
case 'location':
const locationBody = body as WecomLocationMessageBody;
session.content = segment('location', {
latitude: locationBody.Location_X,
longitude: locationBody.Location_Y,
scale: locationBody.Scale,
label: locationBody.Label,
});
break;
default:
isKnownMessage = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment