Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-adapter-wechaty
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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-wechaty
Commits
6ea4e5d1
Commit
6ea4e5d1
authored
May 11, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix message history
parent
5523c6c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
src/adapter.ts
src/adapter.ts
+7
-0
src/index.ts
src/index.ts
+3
-0
No files found.
src/adapter.ts
View file @
6ea4e5d1
...
...
@@ -34,6 +34,12 @@ export class WechatyAdapter extends Adapter.Client<WechatyBot> {
if
(
!
payload
)
return
;
payload
.
timestamp
??
=
timestamp
;
const
session
=
this
.
bot
.
session
(
payload
);
if
(
session
.
type
===
'
message
'
&&
Date
.
now
()
-
this
.
bot
.
loginTime
<
1000
)
{
return
;
}
this
.
bot
.
dispatch
(
session
);
});
});
...
...
@@ -43,6 +49,7 @@ export class WechatyAdapter extends Adapter.Client<WechatyBot> {
this
.
adaptEvent
(
'
message
'
,
async
(
message
)
=>
{
const
adaptedMessage
=
await
adaptMessage
(
this
.
bot
,
message
);
if
(
!
adaptedMessage
)
return
;
// console.log(`Got message type ${message.type()}`);
return
{
...
adaptedMessage
,
type
:
...
...
src/index.ts
View file @
6ea4e5d1
...
...
@@ -69,11 +69,14 @@ export default class WechatyBot extends Bot<
return
PluginDef
(
WechatyAdapter
,
this
);
}
loginTime
:
number
;
async
initialize
()
{
this
.
internal
.
on
(
'
login
'
,
async
(
user
)
=>
{
this
.
selfId
=
user
.
id
;
this
.
username
=
user
.
name
();
this
.
avatar
=
await
fileBoxToUrl
(
await
user
.
avatar
());
this
.
loginTime
=
Date
.
now
();
this
.
online
();
});
this
.
internal
.
on
(
'
logout
'
,
()
=>
{
...
...
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