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
6c757017
Commit
6c757017
authored
Dec 18, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
7b59cf4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
dev/index.ts
dev/index.ts
+3
-3
src/index.ts
src/index.ts
+15
-15
src/utils.ts
src/utils.ts
+1
-0
No files found.
dev/index.ts
View file @
6c757017
...
...
@@ -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
)
=>
{
...
...
src/index.ts
View file @
6c757017
...
...
@@ -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
>
;
}
}
}
...
...
src/utils.ts
View file @
6c757017
...
...
@@ -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
'
:
...
...
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