Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-adapter-wecom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
koishi-plugin-adapter-wecom
Commits
ca6a8697
Commit
ca6a8697
authored
Mar 17, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more receive segments
parent
1e1b5509
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
src/def/def.ts
src/def/def.ts
+15
-0
src/utils.ts
src/utils.ts
+27
-0
No files found.
src/def/def.ts
View file @
ca6a8697
...
...
@@ -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
;
...
...
src/utils.ts
View file @
ca6a8697
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment