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
0
Issues
0
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
initialencounter
koishi-plugin-adapter-wechaty
Commits
db49d9e2
Commit
db49d9e2
authored
Dec 20, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update bot self info
parent
f1584890
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
dev/index.ts
dev/index.ts
+3
-1
src/index.ts
src/index.ts
+9
-9
No files found.
dev/index.ts
View file @
db49d9e2
...
...
@@ -19,7 +19,9 @@ app.plugin(TargetPlugin, {
});
app
.
on
(
'
bot-status-updated
'
,
(
bot
)
=>
console
.
log
(
`Bot
${
bot
.
selfId
}
status updated:
${
bot
.
status
}
`
),
console
.
log
(
`Bot
${
bot
.
sid
}
${
bot
.
username
}
${
bot
.
avatar
?.
length
}
status
updated
:
$
{
bot
.
status
}
`
,
),
);
app
.
on
(
'
message
'
,
(
session
)
=>
console
.
log
(
`Got message from
${
session
.
channelId
}
:
${
session
.
content
}
`
),
...
...
src/index.ts
View file @
db49d9e2
...
...
@@ -10,10 +10,10 @@ import {
UsePlugin
,
}
from
'
koishi-thirdeye
'
;
import
{
Bot
,
Fragment
,
Logger
,
Schema
,
segment
,
SendOptions
}
from
'
koishi
'
;
import
{
WechatyBuilder
}
from
'
wechaty
'
;
import
{
WechatyBuilder
,
WechatyOptions
}
from
'
wechaty
'
;
import
{
WechatyEvents
,
WechatyInstance
}
from
'
./def
'
;
import
{
WechatyAdapter
}
from
'
./adapter
'
;
import
{
adaptContact
,
adaptMessage
,
adaptRoom
}
from
'
./utils
'
;
import
{
adaptContact
,
adaptMessage
,
adaptRoom
,
fileBoxToUrl
}
from
'
./utils
'
;
import
{
WechatyMessenger
}
from
'
./message
'
;
declare
module
'
koishi
'
{
...
...
@@ -48,7 +48,9 @@ export class WechatyBotConfig {
@
Reusable
()
@
PluginSchema
(
WechatyBotConfig
)
@
DefinePlugin
()
export
default
class
WechatyBot
extends
Bot
<
Partial
<
WechatyBotConfig
>>
{
export
default
class
WechatyBot
extends
Bot
<
Partial
<
WechatyBotConfig
&
WechatyOptions
>
>
{
internal
:
WechatyInstance
;
@
InjectLogger
()
...
...
@@ -56,17 +58,15 @@ export default class WechatyBot extends Bot<Partial<WechatyBotConfig>> {
@
UsePlugin
()
loadAdapter
()
{
this
.
internal
=
WechatyBuilder
.
build
({
name
:
this
.
config
.
name
,
puppetOptions
:
this
.
config
.
puppetOptions
,
puppet
:
this
.
config
.
puppet
as
any
,
});
this
.
internal
=
WechatyBuilder
.
build
(
this
.
config
as
any
);
return
PluginDef
(
WechatyAdapter
,
this
);
}
async
initialize
()
{
this
.
internal
.
on
(
'
login
'
,
(
user
)
=>
{
this
.
internal
.
on
(
'
login
'
,
async
(
user
)
=>
{
this
.
selfId
=
user
.
id
;
this
.
username
=
user
.
name
();
this
.
avatar
=
await
fileBoxToUrl
(
await
user
.
avatar
());
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