Commit ca6a8697 authored by nanahira's avatar nanahira

more receive segments

parent 1e1b5509
...@@ -52,6 +52,21 @@ export interface WecomPicBody extends WecomMediaBody { ...@@ -52,6 +52,21 @@ export interface WecomPicBody extends WecomMediaBody {
PicUrl: string; 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 { export interface WecomLinkBody extends WecomEventBody {
Title: string; Title: string;
Description: string; Description: string;
......
...@@ -5,9 +5,12 @@ import { ...@@ -5,9 +5,12 @@ import {
WecomEventResponse, WecomEventResponse,
WecomLinkBody, WecomLinkBody,
WecomLocationBody, WecomLocationBody,
WecomLocationMessageBody,
WecomPicBody, WecomPicBody,
WecomResponse, WecomResponse,
WeComUser, WeComUser,
WecomVideoBody,
WecomVoiceBody,
} from './def'; } from './def';
export interface AdapterConfig { export interface AdapterConfig {
...@@ -70,6 +73,30 @@ export function adaptSession(bot: WeComBot, input: WecomEventResponse) { ...@@ -70,6 +73,30 @@ export function adaptSession(bot: WeComBot, input: WecomEventResponse) {
case 'link': case 'link':
const linkBody = body as WecomLinkBody; const linkBody = body as WecomLinkBody;
session.content = linkBody.Url; 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: default:
isKnownMessage = false; 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