Commit 6c757017 authored by nanahira's avatar nanahira

fix

parent 7b59cf4c
......@@ -50,14 +50,14 @@ app.plugin(WeComBot, {
encodingAESKey: 'encodingAESKey', // 加密密钥,在应用消息接收设置中设置并填入
});
app.on('wecom/location', (session) => {
app.on('wecom/LOCATION', (session) => {
console.log(
`Got location for ${session.userId}: ${session.wecom.Longitude} ${session.wecom.Latitude}`,
);
});
app.on('wecom/enter-agent', (session) => {
console.log(`Got enter-agent for ${session.userId}`);
app.on('wecom/enter_agent', (session) => {
console.log(`Got enter_agent for ${session.userId}`);
});
app.on('wecom/click', (session) => {
......
......@@ -51,15 +51,15 @@ declare global {
wecom?: WecomEventBody;
}
interface Events {
'wecom/enter-agent': WecomEventFunction;
'wecom/enter_agent': WecomEventFunction;
'wecom/subscribe': WecomEventFunction;
'wecom/unsubscribe': WecomEventFunction;
'wecom/location': WecomEventFunction<{
'wecom/LOCATION': WecomEventFunction<{
Latitude: number;
Longitude: number;
Precision: number;
}>;
'wecom/batch-job-result': WecomEventFunction<{
'wecom/batch_job_result': WecomEventFunction<{
BatchJob: {
JobId: string;
JobType: string;
......@@ -69,12 +69,12 @@ declare global {
}>;
'wecom/click': WecomEventFunction<EventKeyBody>;
'wecom/view': WecomEventFunction<EventKeyBody>;
'wecom/scancode-push': WecomEventFunction<ScanCodeEventBody>;
'wecom/scancode-waitmsg': WecomEventFunction<ScanCodeEventBody>;
'wecom/pic-sysphoto': WecomEventFunction<PhotoEventBody>;
'wecom/pic-photo-or-album': WecomEventFunction<PhotoEventBody>;
'wecom/pic-weixin': WecomEventFunction<PhotoEventBody>;
'wecom/location-select': WecomEventFunction<
'wecom/scancode_push': WecomEventFunction<ScanCodeEventBody>;
'wecom/scancode_waitmsg': WecomEventFunction<ScanCodeEventBody>;
'wecom/pic_sysphoto': WecomEventFunction<PhotoEventBody>;
'wecom/pic_photo_or_album': WecomEventFunction<PhotoEventBody>;
'wecom/pic_weixin': WecomEventFunction<PhotoEventBody>;
'wecom/location_select': WecomEventFunction<
EventKeyBody & {
SendLocationInfo: {
Location_X: number;
......@@ -85,18 +85,18 @@ declare global {
};
}
>;
'wecom/share-agent-change': WecomEventFunction;
'wecom/share-chain-change': WecomEventFunction;
'wecom/template-card-event': WecomEventFunction<
'wecom/share_agent_change': WecomEventFunction;
'wecom/share_chain_change': WecomEventFunction;
'wecom/template_card_event': WecomEventFunction<
CardEvent & {
SelectedItems: CardEventSelectedItems;
}
>;
'wecom/template-card-menu-event': WecomEventFunction<CardEvent>;
'wecom/open-approval-change': WecomEventFunction<{
'wecom/template_card_menu_event': WecomEventFunction<CardEvent>;
'wecom/open_approval_change': WecomEventFunction<{
ApprovalInfo: ApprovalInfo;
}>;
'wecom/change-contact': WecomEventFunction<ChangeContact>;
'wecom/change_contact': WecomEventFunction<ChangeContact>;
}
}
}
......
......@@ -39,6 +39,7 @@ export function adaptSession(bot: WeComBot, input: WecomEventResponse) {
};
if (body.MsgType === 'event' && !body.Event.startsWith('template_card_')) {
session.type = `wecom/${body.Event.replace('LOCATION', 'location')}`;
console.log(`Got event ${session.type}`);
} else {
switch (body.MsgType) {
case 'text':
......
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