Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Thirdeye
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
3rdeye
Koishi Thirdeye
Commits
5d576ae8
Commit
5d576ae8
authored
Dec 20, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ReplySession
parent
3820be00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
293 additions
and
120 deletions
+293
-120
index.ts
index.ts
+1
-0
package-lock.json
package-lock.json
+119
-119
package.json
package.json
+1
-1
src/reply-session.ts
src/reply-session.ts
+172
-0
No files found.
index.ts
View file @
5d576ae8
...
...
@@ -3,3 +3,4 @@ export * from './src/cosmotype-exports';
export
*
from
'
./src/decorators
'
;
export
*
from
'
./src/def
'
;
export
*
from
'
./src/registrar
'
;
export
*
from
'
./src/reply-session
'
;
package-lock.json
View file @
5d576ae8
...
...
@@ -31,7 +31,7 @@
"typescript"
:
"^4.8.2"
},
"peerDependencies"
:
{
"koishi"
:
"^4.10.
4
"
"koishi"
:
"^4.10.
6
"
}
},
"node_modules/@ampproject/remapping"
:
{
...
...
@@ -1106,16 +1106,16 @@
}
},
"node_modules/@koishijs/core"
:
{
"version"
:
"4.10.
4
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/core/-/core-4.10.
4
.tgz"
,
"integrity"
:
"sha512-
uhR2RoslHs3ynhElWP+jIwzqn8PprlPGF10qWQvTpW1l5XmPr+PiWgf5HmAGt1XucWcuij9n1Z179yqZs6xLNg
=="
,
"version"
:
"4.10.
6
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/core/-/core-4.10.
6
.tgz"
,
"integrity"
:
"sha512-
5rOr40u41SZzCvQObqGf2DANakFWWRvDditZG+0Z1/zczX6o+UJy9TXZUHEpTMfvMMEG7+DNECPZz8F6X8drLw
=="
,
"peer"
:
true
,
"dependencies"
:
{
"@koishijs/utils"
:
"^6.
2.6
"
,
"@minatojs/core"
:
"^2.0.
1
"
,
"@satorijs/core"
:
"^1.4.
3
"
,
"@koishijs/utils"
:
"^6.
3.4
"
,
"@minatojs/core"
:
"^2.0.
3
"
,
"@satorijs/core"
:
"^1.4.
10
"
,
"cordis"
:
"^2.6.0"
,
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
6
"
,
"fastest-levenshtein"
:
"^1.0.16"
}
},
...
...
@@ -1133,23 +1133,23 @@
}
},
"node_modules/@koishijs/utils"
:
{
"version"
:
"6.
2.6
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/utils/-/utils-6.
2.6
.tgz"
,
"integrity"
:
"sha512-
JAqzAmTLwLwd4LHRoLjMvCojHeyDiGaKqgpd7p3/PMeXL7aHtN+owPv0xtn9jB375llGHYQT51PMkiLMbAIpYw
=="
,
"version"
:
"6.
3.4
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/utils/-/utils-6.
3.4
.tgz"
,
"integrity"
:
"sha512-
P8hQOTVYsk5rCkBcYbIKKKBm58etGlY/Q3xOuMEyz6BlTe0V8A6lFv56nInuPIaTOf4XprTceZBE6Oe3lC8RuQ
=="
,
"peer"
:
true
,
"dependencies"
:
{
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
6
"
,
"inaba"
:
"^1.1.1"
,
"reggol"
:
"^1.3.
2
"
,
"schemastery"
:
"^3.
5.4
"
"reggol"
:
"^1.3.
3
"
,
"schemastery"
:
"^3.
6.1
"
}
},
"node_modules/@minatojs/core"
:
{
"version"
:
"2.0.
1
"
,
"resolved"
:
"https://registry.npmjs.org/@minatojs/core/-/core-2.0.
1
.tgz"
,
"integrity"
:
"sha512-
li7js0EZGw3PV28VM9B/aBX2QeKwvk32U4Haf4uvq0iBTH7L4JRq4YbOqlO5ZjrExoZS4RHBZtz4wzfW3Ay3j
w=="
,
"version"
:
"2.0.
3
"
,
"resolved"
:
"https://registry.npmjs.org/@minatojs/core/-/core-2.0.
3
.tgz"
,
"integrity"
:
"sha512-
VZo1sDl9jLcejMyEfd/A+yZt/qre3vB+woSIZmWCm78zBR+CkFPk56y5EAMnu0cW9kgtq0p/KHa2VUVXyN71B
w=="
,
"dependencies"
:
{
"cosmokit"
:
"^1.3.
3
"
"cosmokit"
:
"^1.3.
4
"
}
},
"node_modules/@nodelib/fs.scandir"
:
{
...
...
@@ -1188,37 +1188,37 @@
}
},
"node_modules/@satorijs/core"
:
{
"version"
:
"1.4.
3
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/core/-/core-1.4.
3
.tgz"
,
"integrity"
:
"sha512-
L0VJVq3jlb8r4IaYlNBMfh4A3vskDMeQwl9Y5lgXBlShxsMzn2XcgtDKfa4WgNH4HzRFjS8iLkVBSo9jDW+3TA
=="
,
"version"
:
"1.4.
10
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/core/-/core-1.4.
10
.tgz"
,
"integrity"
:
"sha512-
eTHYuoW6KAh6Fko874b9/50hq+CGD2FMFTT2K2htNdMFhKdGYkum3vpqmudPlThCefH4608rR5jU1vsebsKTrQ
=="
,
"peer"
:
true
,
"dependencies"
:
{
"@satorijs/element"
:
"^2.
1.7
"
,
"@satorijs/element"
:
"^2.
2.1
"
,
"cordis"
:
"^2.6.0"
,
"cordis-axios"
:
"^2.1.
5
"
,
"cosmokit"
:
"^1.3.
3
"
,
"reggol"
:
"^1.3.
2
"
,
"schemastery"
:
"^3.
5.4
"
,
"cordis-axios"
:
"^2.1.
6
"
,
"cosmokit"
:
"^1.3.
6
"
,
"reggol"
:
"^1.3.
3
"
,
"schemastery"
:
"^3.
6.1
"
,
"ws"
:
"^8.11.0"
}
},
"node_modules/@satorijs/element"
:
{
"version"
:
"2.
1.7
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/element/-/element-2.
1.7
.tgz"
,
"integrity"
:
"sha512-
GCj/vkszJqg3kfhrMkzVATYh4wDqJnNyrPyTlOHWQ6CD1FWRDVhtoSEsSTbwMFZDiVM17Nf3OD37CM5WrlFL7
g=="
,
"version"
:
"2.
2.1
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/element/-/element-2.
2.1
.tgz"
,
"integrity"
:
"sha512-
4oINBNinlxUQL+lsGKkGYgITNSGRfDeUUmE2lzHYbg/WSVg2eK11pNHtwGbud0KxnmNG687NxyF9czgd7t/4h
g=="
,
"peer"
:
true
,
"dependencies"
:
{
"cosmokit"
:
"^1.3.
3
"
"cosmokit"
:
"^1.3.
6
"
}
},
"node_modules/@satorijs/satori"
:
{
"version"
:
"1.4.
3
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.
3
.tgz"
,
"integrity"
:
"sha512-
XgMolxa9/9gWf4+VKqLioBkzuZA0QXQIMWZHFET1dVvQjbxNhaETF0NBmwFSjbVBOWvTN8vecTGTSLc3pQn+R
w=="
,
"version"
:
"1.4.
10
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.
10
.tgz"
,
"integrity"
:
"sha512-
6rT02tmMyv/Tw0o9xaCH+uW8c947LcvLI2pDD/RG01X+hyh8OfGbeAK59GtKcIY9lnA3Rma7jCIB7dkMjPpt0
w=="
,
"peer"
:
true
,
"dependencies"
:
{
"@koa/router"
:
"^10.1.1"
,
"@satorijs/core"
:
"1.4.
3
"
,
"@satorijs/core"
:
"1.4.
10
"
,
"@types/koa"
:
"*"
,
"@types/koa__router"
:
"*"
,
"@types/ws"
:
"^8.5.3"
,
...
...
@@ -1229,7 +1229,7 @@
"koa-bodyparser"
:
"^4.3.0"
,
"parseurl"
:
"^1.3.3"
,
"path-to-regexp"
:
"^6.2.1"
,
"schemastery"
:
"^3.
5.4
"
,
"schemastery"
:
"^3.
6.1
"
,
"socks-proxy-agent"
:
"^5.0.1"
,
"ws"
:
"^8.11.0"
},
...
...
@@ -2387,16 +2387,16 @@
}
},
"node_modules/cordis-axios"
:
{
"version"
:
"2.1.
5
"
,
"resolved"
:
"https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.
5
.tgz"
,
"integrity"
:
"sha512-
L5cHolNBlo4MxhfWRETpz1G20jF6J0Hu+5zPxebo0XJthqO0eI6U/2DrbQvXARnyMhuQIIZfoPJLvSNgd0Rjzw
=="
,
"version"
:
"2.1.
6
"
,
"resolved"
:
"https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.
6
.tgz"
,
"integrity"
:
"sha512-
GaJq5zoh4XRAFHEOyCLyU7kIcRrV7hqDVEh5kF4t047TmROAUaLukPKSMeMVMNohpKW4Vz+tj2FGEqMx5NuBQg
=="
,
"peer"
:
true
,
"dependencies"
:
{
"axios"
:
"~1.1.3"
,
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
4
"
,
"file-type"
:
"^16.5.4"
,
"mime-db"
:
"^1.52.0"
,
"schemastery"
:
"^3.
5.4
"
"schemastery"
:
"^3.
6.1
"
},
"engines"
:
{
"node"
:
">=12.0.0"
...
...
@@ -2432,9 +2432,9 @@
}
},
"node_modules/cosmokit"
:
{
"version"
:
"1.3.
3
"
,
"resolved"
:
"https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.
3
.tgz"
,
"integrity"
:
"sha512-
jpEp5zDrGbycu8AdaCjmNNr2J617NAFvAU6GM8o/dJP2/pe80qTbPoflqyJzAuMhiaC6QCXlBP0KCusTsDemPQ
=="
"version"
:
"1.3.
6
"
,
"resolved"
:
"https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.
6
.tgz"
,
"integrity"
:
"sha512-
buZvC7fuqBbSimJfkaaTJmlelpgj56L7VybjNkCy5UVvShMVQHi/bTZcuBfYLBwpuebSfvDZPwwHS5IfcoAnxg
=="
},
"node_modules/cross-spawn"
:
{
"version"
:
"7.0.3"
,
...
...
@@ -4486,9 +4486,9 @@
}
},
"node_modules/koa"
:
{
"version"
:
"2.1
3.4
"
,
"resolved"
:
"https://registry.npmjs.org/koa/-/koa-2.1
3.4
.tgz"
,
"integrity"
:
"sha512-
43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g
=="
,
"version"
:
"2.1
4.1
"
,
"resolved"
:
"https://registry.npmjs.org/koa/-/koa-2.1
4.1
.tgz"
,
"integrity"
:
"sha512-
USJFyZgi2l0wDgqkfD27gL4YGno7TfUkcmOe6UOLFOVuN+J7FwnNu4Dydl4CUQzraM1lBAiGed0M9OVJoT0Kqw
=="
,
"peer"
:
true
,
"dependencies"
:
{
"accepts"
:
"^1.3.5"
,
...
...
@@ -4561,14 +4561,14 @@
}
},
"node_modules/koishi"
:
{
"version"
:
"4.10.
4
"
,
"resolved"
:
"https://registry.npmjs.org/koishi/-/koishi-4.10.
4
.tgz"
,
"integrity"
:
"sha512-
06ylHCmyyj8buQxPcnuSap7Yco6HtzC0o61AwBuBOikdILQj2WicexztohuLhQ/9ElA3pEOsJaHzDa/9Lh71Ng
=="
,
"version"
:
"4.10.
6
"
,
"resolved"
:
"https://registry.npmjs.org/koishi/-/koishi-4.10.
6
.tgz"
,
"integrity"
:
"sha512-
s/VDoMKihMsjodSU9Vhs1Kkk3psQ6/sNx7MNuxAFo5KsXIJOgAQnJ+5TZxiqyGgxNT7NVNB4RHdQVDkYydbG1Q
=="
,
"peer"
:
true
,
"dependencies"
:
{
"@koishijs/core"
:
"^4.10.
4
"
,
"@koishijs/utils"
:
"^6.
2.6
"
,
"@satorijs/satori"
:
"^1.4.
3
"
,
"@koishijs/core"
:
"^4.10.
6
"
,
"@koishijs/utils"
:
"^6.
3.4
"
,
"@satorijs/satori"
:
"^1.4.
10
"
,
"file-type"
:
"^16.5.4"
,
"ns-require"
:
"^1.1.4"
},
...
...
@@ -5344,12 +5344,12 @@
}
},
"node_modules/reggol"
:
{
"version"
:
"1.3.
2
"
,
"resolved"
:
"https://registry.npmjs.org/reggol/-/reggol-1.3.
2
.tgz"
,
"integrity"
:
"sha512-
vI+nWzdBJlO9OsrDCJ/z5NS4/o1mzHjwrZcn6LoESHn2get7LrbZ0TZB/dEkCtUlah324rxd5E2zciT/98Op1
Q=="
,
"version"
:
"1.3.
3
"
,
"resolved"
:
"https://registry.npmjs.org/reggol/-/reggol-1.3.
3
.tgz"
,
"integrity"
:
"sha512-
AmFo4aBBLwd1IosfkQ9cnWJF+RDXjrfmY2pFeRXSLlvi1UoqMYLsltR/514R8Dr/ZfAYdcD75V/vFDK60hgyO
Q=="
,
"peer"
:
true
,
"dependencies"
:
{
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
6
"
,
"object-inspect"
:
"^1.12.2"
,
"supports-color"
:
"^8.1.1"
}
...
...
@@ -5539,12 +5539,12 @@
}
},
"node_modules/schemastery"
:
{
"version"
:
"3.
5.4
"
,
"resolved"
:
"https://registry.npmjs.org/schemastery/-/schemastery-3.
5.4
.tgz"
,
"integrity"
:
"sha512-
YPr+tR4fFt/d1gH0AXQjlr+Luw5+3Hz75tWT8g8Iqt1wnNTys3+TB2wAaekrTKhgnWhQPCHwDfLF1KZHNTNqu
w=="
,
"version"
:
"3.
6.1
"
,
"resolved"
:
"https://registry.npmjs.org/schemastery/-/schemastery-3.
6.1
.tgz"
,
"integrity"
:
"sha512-
Igh4oqaHco1AYmqpSgYgg411gNomSI9xE35Xo/FuzJZTMYWA5W1o+82Q5qMnt9FAQ76gZig0pea9OcHl0AM/L
w=="
,
"peer"
:
true
,
"dependencies"
:
{
"cosmokit"
:
"^1.
2.1
"
"cosmokit"
:
"^1.
3.4
"
}
},
"node_modules/schemastery-gen"
:
{
...
...
@@ -7237,16 +7237,16 @@
}
},
"@koishijs/core"
:
{
"version"
:
"4.10.
4
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/core/-/core-4.10.
4
.tgz"
,
"integrity"
:
"sha512-
uhR2RoslHs3ynhElWP+jIwzqn8PprlPGF10qWQvTpW1l5XmPr+PiWgf5HmAGt1XucWcuij9n1Z179yqZs6xLNg
=="
,
"version"
:
"4.10.
6
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/core/-/core-4.10.
6
.tgz"
,
"integrity"
:
"sha512-
5rOr40u41SZzCvQObqGf2DANakFWWRvDditZG+0Z1/zczX6o+UJy9TXZUHEpTMfvMMEG7+DNECPZz8F6X8drLw
=="
,
"peer"
:
true
,
"requires"
:
{
"@koishijs/utils"
:
"^6.
2.6
"
,
"@minatojs/core"
:
"^2.0.
1
"
,
"@satorijs/core"
:
"^1.4.
3
"
,
"@koishijs/utils"
:
"^6.
3.4
"
,
"@minatojs/core"
:
"^2.0.
3
"
,
"@satorijs/core"
:
"^1.4.
10
"
,
"cordis"
:
"^2.6.0"
,
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
6
"
,
"fastest-levenshtein"
:
"^1.0.16"
}
},
...
...
@@ -7261,23 +7261,23 @@
}
},
"@koishijs/utils"
:
{
"version"
:
"6.
2.6
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/utils/-/utils-6.
2.6
.tgz"
,
"integrity"
:
"sha512-
JAqzAmTLwLwd4LHRoLjMvCojHeyDiGaKqgpd7p3/PMeXL7aHtN+owPv0xtn9jB375llGHYQT51PMkiLMbAIpYw
=="
,
"version"
:
"6.
3.4
"
,
"resolved"
:
"https://registry.npmjs.org/@koishijs/utils/-/utils-6.
3.4
.tgz"
,
"integrity"
:
"sha512-
P8hQOTVYsk5rCkBcYbIKKKBm58etGlY/Q3xOuMEyz6BlTe0V8A6lFv56nInuPIaTOf4XprTceZBE6Oe3lC8RuQ
=="
,
"peer"
:
true
,
"requires"
:
{
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
6
"
,
"inaba"
:
"^1.1.1"
,
"reggol"
:
"^1.3.
2
"
,
"schemastery"
:
"^3.
5.4
"
"reggol"
:
"^1.3.
3
"
,
"schemastery"
:
"^3.
6.1
"
}
},
"@minatojs/core"
:
{
"version"
:
"2.0.
1
"
,
"resolved"
:
"https://registry.npmjs.org/@minatojs/core/-/core-2.0.
1
.tgz"
,
"integrity"
:
"sha512-
li7js0EZGw3PV28VM9B/aBX2QeKwvk32U4Haf4uvq0iBTH7L4JRq4YbOqlO5ZjrExoZS4RHBZtz4wzfW3Ay3j
w=="
,
"version"
:
"2.0.
3
"
,
"resolved"
:
"https://registry.npmjs.org/@minatojs/core/-/core-2.0.
3
.tgz"
,
"integrity"
:
"sha512-
VZo1sDl9jLcejMyEfd/A+yZt/qre3vB+woSIZmWCm78zBR+CkFPk56y5EAMnu0cW9kgtq0p/KHa2VUVXyN71B
w=="
,
"requires"
:
{
"cosmokit"
:
"^1.3.
3
"
"cosmokit"
:
"^1.3.
4
"
}
},
"@nodelib/fs.scandir"
:
{
...
...
@@ -7307,37 +7307,37 @@
}
},
"@satorijs/core"
:
{
"version"
:
"1.4.
3
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/core/-/core-1.4.
3
.tgz"
,
"integrity"
:
"sha512-
L0VJVq3jlb8r4IaYlNBMfh4A3vskDMeQwl9Y5lgXBlShxsMzn2XcgtDKfa4WgNH4HzRFjS8iLkVBSo9jDW+3TA
=="
,
"version"
:
"1.4.
10
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/core/-/core-1.4.
10
.tgz"
,
"integrity"
:
"sha512-
eTHYuoW6KAh6Fko874b9/50hq+CGD2FMFTT2K2htNdMFhKdGYkum3vpqmudPlThCefH4608rR5jU1vsebsKTrQ
=="
,
"peer"
:
true
,
"requires"
:
{
"@satorijs/element"
:
"^2.
1.7
"
,
"@satorijs/element"
:
"^2.
2.1
"
,
"cordis"
:
"^2.6.0"
,
"cordis-axios"
:
"^2.1.
5
"
,
"cosmokit"
:
"^1.3.
3
"
,
"reggol"
:
"^1.3.
2
"
,
"schemastery"
:
"^3.
5.4
"
,
"cordis-axios"
:
"^2.1.
6
"
,
"cosmokit"
:
"^1.3.
6
"
,
"reggol"
:
"^1.3.
3
"
,
"schemastery"
:
"^3.
6.1
"
,
"ws"
:
"^8.11.0"
}
},
"@satorijs/element"
:
{
"version"
:
"2.
1.7
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/element/-/element-2.
1.7
.tgz"
,
"integrity"
:
"sha512-
GCj/vkszJqg3kfhrMkzVATYh4wDqJnNyrPyTlOHWQ6CD1FWRDVhtoSEsSTbwMFZDiVM17Nf3OD37CM5WrlFL7
g=="
,
"version"
:
"2.
2.1
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/element/-/element-2.
2.1
.tgz"
,
"integrity"
:
"sha512-
4oINBNinlxUQL+lsGKkGYgITNSGRfDeUUmE2lzHYbg/WSVg2eK11pNHtwGbud0KxnmNG687NxyF9czgd7t/4h
g=="
,
"peer"
:
true
,
"requires"
:
{
"cosmokit"
:
"^1.3.
3
"
"cosmokit"
:
"^1.3.
6
"
}
},
"@satorijs/satori"
:
{
"version"
:
"1.4.
3
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.
3
.tgz"
,
"integrity"
:
"sha512-
XgMolxa9/9gWf4+VKqLioBkzuZA0QXQIMWZHFET1dVvQjbxNhaETF0NBmwFSjbVBOWvTN8vecTGTSLc3pQn+R
w=="
,
"version"
:
"1.4.
10
"
,
"resolved"
:
"https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.
10
.tgz"
,
"integrity"
:
"sha512-
6rT02tmMyv/Tw0o9xaCH+uW8c947LcvLI2pDD/RG01X+hyh8OfGbeAK59GtKcIY9lnA3Rma7jCIB7dkMjPpt0
w=="
,
"peer"
:
true
,
"requires"
:
{
"@koa/router"
:
"^10.1.1"
,
"@satorijs/core"
:
"1.4.
3
"
,
"@satorijs/core"
:
"1.4.
10
"
,
"@types/koa"
:
"*"
,
"@types/koa__router"
:
"*"
,
"@types/ws"
:
"^8.5.3"
,
...
...
@@ -7348,7 +7348,7 @@
"koa-bodyparser"
:
"^4.3.0"
,
"parseurl"
:
"^1.3.3"
,
"path-to-regexp"
:
"^6.2.1"
,
"schemastery"
:
"^3.
5.4
"
,
"schemastery"
:
"^3.
6.1
"
,
"socks-proxy-agent"
:
"^5.0.1"
,
"ws"
:
"^8.11.0"
}
...
...
@@ -8257,16 +8257,16 @@
}
},
"cordis-axios"
:
{
"version"
:
"2.1.
5
"
,
"resolved"
:
"https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.
5
.tgz"
,
"integrity"
:
"sha512-
L5cHolNBlo4MxhfWRETpz1G20jF6J0Hu+5zPxebo0XJthqO0eI6U/2DrbQvXARnyMhuQIIZfoPJLvSNgd0Rjzw
=="
,
"version"
:
"2.1.
6
"
,
"resolved"
:
"https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.
6
.tgz"
,
"integrity"
:
"sha512-
GaJq5zoh4XRAFHEOyCLyU7kIcRrV7hqDVEh5kF4t047TmROAUaLukPKSMeMVMNohpKW4Vz+tj2FGEqMx5NuBQg
=="
,
"peer"
:
true
,
"requires"
:
{
"axios"
:
"~1.1.3"
,
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
4
"
,
"file-type"
:
"^16.5.4"
,
"mime-db"
:
"^1.52.0"
,
"schemastery"
:
"^3.
5.4
"
"schemastery"
:
"^3.
6.1
"
},
"dependencies"
:
{
"mime-db"
:
{
...
...
@@ -8291,9 +8291,9 @@
}
},
"cosmokit"
:
{
"version"
:
"1.3.
3
"
,
"resolved"
:
"https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.
3
.tgz"
,
"integrity"
:
"sha512-
jpEp5zDrGbycu8AdaCjmNNr2J617NAFvAU6GM8o/dJP2/pe80qTbPoflqyJzAuMhiaC6QCXlBP0KCusTsDemPQ
=="
"version"
:
"1.3.
6
"
,
"resolved"
:
"https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.
6
.tgz"
,
"integrity"
:
"sha512-
buZvC7fuqBbSimJfkaaTJmlelpgj56L7VybjNkCy5UVvShMVQHi/bTZcuBfYLBwpuebSfvDZPwwHS5IfcoAnxg
=="
},
"cross-spawn"
:
{
"version"
:
"7.0.3"
,
...
...
@@ -9822,9 +9822,9 @@
"dev"
:
true
},
"koa"
:
{
"version"
:
"2.1
3.4
"
,
"resolved"
:
"https://registry.npmjs.org/koa/-/koa-2.1
3.4
.tgz"
,
"integrity"
:
"sha512-
43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g
=="
,
"version"
:
"2.1
4.1
"
,
"resolved"
:
"https://registry.npmjs.org/koa/-/koa-2.1
4.1
.tgz"
,
"integrity"
:
"sha512-
USJFyZgi2l0wDgqkfD27gL4YGno7TfUkcmOe6UOLFOVuN+J7FwnNu4Dydl4CUQzraM1lBAiGed0M9OVJoT0Kqw
=="
,
"peer"
:
true
,
"requires"
:
{
"accepts"
:
"^1.3.5"
,
...
...
@@ -9887,14 +9887,14 @@
}
},
"koishi"
:
{
"version"
:
"4.10.
4
"
,
"resolved"
:
"https://registry.npmjs.org/koishi/-/koishi-4.10.
4
.tgz"
,
"integrity"
:
"sha512-
06ylHCmyyj8buQxPcnuSap7Yco6HtzC0o61AwBuBOikdILQj2WicexztohuLhQ/9ElA3pEOsJaHzDa/9Lh71Ng
=="
,
"version"
:
"4.10.
6
"
,
"resolved"
:
"https://registry.npmjs.org/koishi/-/koishi-4.10.
6
.tgz"
,
"integrity"
:
"sha512-
s/VDoMKihMsjodSU9Vhs1Kkk3psQ6/sNx7MNuxAFo5KsXIJOgAQnJ+5TZxiqyGgxNT7NVNB4RHdQVDkYydbG1Q
=="
,
"peer"
:
true
,
"requires"
:
{
"@koishijs/core"
:
"^4.10.
4
"
,
"@koishijs/utils"
:
"^6.
2.6
"
,
"@satorijs/satori"
:
"^1.4.
3
"
,
"@koishijs/core"
:
"^4.10.
6
"
,
"@koishijs/utils"
:
"^6.
3.4
"
,
"@satorijs/satori"
:
"^1.4.
10
"
,
"file-type"
:
"^16.5.4"
,
"ns-require"
:
"^1.1.4"
}
...
...
@@ -10462,12 +10462,12 @@
"dev"
:
true
},
"reggol"
:
{
"version"
:
"1.3.
2
"
,
"resolved"
:
"https://registry.npmjs.org/reggol/-/reggol-1.3.
2
.tgz"
,
"integrity"
:
"sha512-
vI+nWzdBJlO9OsrDCJ/z5NS4/o1mzHjwrZcn6LoESHn2get7LrbZ0TZB/dEkCtUlah324rxd5E2zciT/98Op1
Q=="
,
"version"
:
"1.3.
3
"
,
"resolved"
:
"https://registry.npmjs.org/reggol/-/reggol-1.3.
3
.tgz"
,
"integrity"
:
"sha512-
AmFo4aBBLwd1IosfkQ9cnWJF+RDXjrfmY2pFeRXSLlvi1UoqMYLsltR/514R8Dr/ZfAYdcD75V/vFDK60hgyO
Q=="
,
"peer"
:
true
,
"requires"
:
{
"cosmokit"
:
"^1.3.
3
"
,
"cosmokit"
:
"^1.3.
6
"
,
"object-inspect"
:
"^1.12.2"
,
"supports-color"
:
"^8.1.1"
},
...
...
@@ -10608,12 +10608,12 @@
}
},
"schemastery"
:
{
"version"
:
"3.
5.4
"
,
"resolved"
:
"https://registry.npmjs.org/schemastery/-/schemastery-3.
5.4
.tgz"
,
"integrity"
:
"sha512-
YPr+tR4fFt/d1gH0AXQjlr+Luw5+3Hz75tWT8g8Iqt1wnNTys3+TB2wAaekrTKhgnWhQPCHwDfLF1KZHNTNqu
w=="
,
"version"
:
"3.
6.1
"
,
"resolved"
:
"https://registry.npmjs.org/schemastery/-/schemastery-3.
6.1
.tgz"
,
"integrity"
:
"sha512-
Igh4oqaHco1AYmqpSgYgg411gNomSI9xE35Xo/FuzJZTMYWA5W1o+82Q5qMnt9FAQ76gZig0pea9OcHl0AM/L
w=="
,
"peer"
:
true
,
"requires"
:
{
"cosmokit"
:
"^1.
2.1
"
"cosmokit"
:
"^1.
3.4
"
}
},
"schemastery-gen"
:
{
...
...
package.json
View file @
5d576ae8
...
...
@@ -69,6 +69,6 @@
"testEnvironment"
:
"node"
},
"peerDependencies"
:
{
"koishi"
:
"^4.10.
4
"
"koishi"
:
"^4.10.
6
"
}
}
src/reply-session.ts
0 → 100644
View file @
5d576ae8
import
{
Channel
,
Element
,
Fragment
,
Next
,
PromptOptions
,
Random
,
segment
,
SendOptions
,
Session
,
User
,
}
from
'
koishi
'
;
import
{
Provide
,
DefinePlugin
,
UseMiddleware
}
from
'
./decorators
'
;
import
{
StarterPlugin
}
from
'
./registrar
'
;
interface
Prompt
{
resolver
:
(
value
:
string
)
=>
void
;
timeout
:
NodeJS
.
Timeout
;
session
:
ReplySession
;
callback
:
(
session
:
ReplySession
)
=>
any
;
}
declare
module
'
koishi
'
{
interface
Context
{
__prompt_resolver__
:
PromptResolver
;
}
}
export
class
ReplySession
<
U
extends
User
.
Field
=
never
,
G
extends
Channel
.
Field
=
never
,
>
extends
Session
<
U
,
G
>
{
replyMessages
:
Element
[]
=
[];
private
midResolver
:
()
=>
void
;
private
emitPromise
:
Promise
<
any
>
;
private
midPromise
=
new
Promise
<
void
>
((
resolve
)
=>
{
this
.
midResolver
=
resolve
;
});
async
process
()
{
if
(
!
this
.
app
.
lifecycle
.
isActive
)
return
;
const
events
:
string
[]
=
[
this
.
type
];
if
(
this
.
subtype
)
{
events
.
unshift
(
events
[
0
]
+
'
/
'
+
this
.
subtype
);
if
(
this
.
subsubtype
)
{
events
.
unshift
(
events
[
0
]
+
'
/
'
+
this
.
subsubtype
);
}
}
this
.
emitPromise
=
Promise
.
all
(
events
.
map
((
event
)
=>
this
.
app
.
root
.
parallel
(
this
,
event
as
any
,
this
)),
);
return
this
.
waitForPattern
();
}
async
waitForPattern
()
{
await
Promise
.
race
([
this
.
emitPromise
.
then
(()
=>
this
.
midResolve
(
true
)),
this
.
midPromise
,
]);
return
this
.
gatherReplyMessages
();
}
getIdentifier
()
{
return
`
${
this
.
platform
}
:
${
this
.
selfId
}
:
${
this
.
channelId
}
:
${
this
.
userId
}
`
;
}
midResolve
(
finish
=
false
)
{
if
(
!
this
.
midResolver
)
{
return
;
}
this
.
midResolver
();
if
(
finish
)
{
delete
this
.
midResolver
;
}
else
{
this
.
midPromise
=
new
Promise
<
void
>
((
resolve
)
=>
{
this
.
midResolver
=
resolve
;
});
}
}
async
send
(
content
:
Fragment
,
options
:
SendOptions
=
{})
{
if
(
!
content
)
return
;
options
.
session
=
this
;
const
children
=
await
this
.
transform
(
segment
.
normalize
(
content
));
this
.
replyMessages
.
push
(
children
.
length
===
1
?
children
[
0
]
:
segment
(
'
message
'
,
{},
children
),
);
const
messageId
=
Random
.
id
();
const
sentSession
=
this
.
bot
.
session
({
messageId
,
userId
:
this
.
userId
,
timestamp
:
this
.
timestamp
||
Date
.
now
(),
});
sentSession
.
app
.
emit
(
sentSession
,
'
send
'
,
sentSession
);
return
[
messageId
];
}
gatherReplyMessages
()
{
const
result
=
this
.
replyMessages
.
filter
((
m
)
=>
!!
m
);
this
.
replyMessages
=
[];
return
result
;
}
prompt
(...
args
:
any
[])
{
if
(
!
this
.
app
.
__prompt_resolver__
)
{
this
.
app
.
root
.
plugin
(
PromptResolver
);
}
const
resolver
=
this
.
app
.
__prompt_resolver__
;
const
callback
:
(
session
:
Session
)
=>
any
=
typeof
args
[
0
]
===
'
function
'
?
args
.
shift
()
:
(
session
)
=>
session
.
content
;
const
options
:
PromptOptions
=
typeof
args
[
0
]
===
'
number
'
?
{
timeout
:
args
[
0
]
}
:
args
[
0
]
??
{};
const
timeout
=
options
.
timeout
??
this
.
app
.
root
.
options
.
delay
.
prompt
;
const
identifier
=
this
.
getIdentifier
();
const
prom
=
new
Promise
<
string
>
((
resolve
)
=>
{
const
prompt
:
Prompt
=
{
resolver
:
resolve
,
timeout
:
setTimeout
(()
=>
{
resolver
.
resolvePrompt
(
identifier
,
undefined
);
},
timeout
),
session
:
this
,
callback
,
};
resolver
.
addPrompt
(
identifier
,
prompt
);
});
this
.
midResolve
();
return
prom
;
}
}
@
Provide
(
'
__prompt_resolver__
'
,
{
immediate
:
true
})
@
DefinePlugin
()
class
PromptResolver
extends
StarterPlugin
()
{
prompts
=
new
Map
<
string
,
Prompt
>
();
addPrompt
(
identifier
:
string
,
prompt
:
Prompt
)
{
const
oldPrompt
=
this
.
prompts
.
get
(
identifier
);
if
(
oldPrompt
)
{
this
.
resolvePrompt
(
identifier
,
undefined
);
}
this
.
prompts
.
set
(
identifier
,
prompt
);
}
@
UseMiddleware
(
true
)
private
async
handlePrompt
(
session
:
ReplySession
,
next
:
Next
)
{
if
(
!
session
.
getIdentifier
)
{
// not a reply session
return
next
();
}
const
identifier
=
session
.
getIdentifier
();
const
prompt
=
this
.
resolvePrompt
(
identifier
,
session
);
if
(
!
prompt
)
{
return
next
();
}
session
.
replyMessages
.
push
(...(
await
prompt
.
session
.
waitForPattern
()));
return
;
}
resolvePrompt
(
identifier
:
string
,
session
:
ReplySession
)
{
const
prompt
=
this
.
prompts
.
get
(
identifier
);
if
(
prompt
)
{
prompt
.
resolver
(
prompt
.
callback
(
session
));
clearTimeout
(
prompt
.
timeout
);
this
.
prompts
.
delete
(
identifier
);
return
prompt
;
}
return
;
}
}
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