Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Nestjs
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 Nestjs
Commits
883ec4ce
Commit
883ec4ce
authored
Dec 26, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use selection from koishi package
parent
a415b3c6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
28 deletions
+12
-28
README.md
README.md
+1
-1
src/providers/koishi-metascan.service.ts
src/providers/koishi-metascan.service.ts
+0
-1
src/providers/koishi-websocket.gateway.ts
src/providers/koishi-websocket.gateway.ts
+1
-2
src/utility/koishi.decorators.ts
src/utility/koishi.decorators.ts
+8
-2
src/utility/koishi.interfaces.ts
src/utility/koishi.interfaces.ts
+2
-22
No files found.
README.md
View file @
883ec4ce
...
@@ -612,4 +612,4 @@ export class AppModule {}
...
@@ -612,4 +612,4 @@ export class AppModule {}
*
增加了
`@CommandUserFields`
对应
`cmd.userFields`
以及
`@CommandChannelFields`
对应
`cmd.channelFields`
。
*
增加了
`@CommandUserFields`
对应
`cmd.userFields`
以及
`@CommandChannelFields`
对应
`cmd.channelFields`
。
*
增加了用于注入 Koishi 指令调用信息的提供者方法参数装饰器。详见
**指令参数**
部分。
*
增加了用于注入 Koishi 指令调用信息的提供者方法参数装饰器。详见
**指令参数**
部分。
\ No newline at end of file
src/providers/koishi-metascan.service.ts
View file @
883ec4ce
...
@@ -15,7 +15,6 @@ import {
...
@@ -15,7 +15,6 @@ import {
import
{
import
{
CommandPutConfig
,
CommandPutConfig
,
DoRegisterConfig
,
DoRegisterConfig
,
EventName
,
KoishiCommandInterceptorRegistration
,
KoishiCommandInterceptorRegistration
,
KoishiModuleOptions
,
KoishiModuleOptions
,
KoishiModulePlugin
,
KoishiModulePlugin
,
...
...
src/providers/koishi-websocket.gateway.ts
View file @
883ec4ce
...
@@ -10,8 +10,7 @@ import { IncomingMessage } from 'http';
...
@@ -10,8 +10,7 @@ import { IncomingMessage } from 'http';
@
WebSocketGateway
()
@
WebSocketGateway
()
export
class
KoishiWebsocketGateway
export
class
KoishiWebsocketGateway
implements
OnGatewayInit
,
OnGatewayConnection
implements
OnGatewayInit
,
OnGatewayConnection
{
{
constructor
(
private
readonly
koishi
:
KoishiService
)
{}
constructor
(
private
readonly
koishi
:
KoishiService
)
{}
@
WebSocketServer
()
@
WebSocketServer
()
...
...
src/utility/koishi.decorators.ts
View file @
883ec4ce
...
@@ -25,9 +25,15 @@ import {
...
@@ -25,9 +25,15 @@ import {
MetadataGenericMap
,
MetadataGenericMap
,
MetadataKey
,
MetadataKey
,
OnContextFunction
,
OnContextFunction
,
Selection
,
}
from
'
./koishi.interfaces
'
;
}
from
'
./koishi.interfaces
'
;
import
{
Argv
,
Command
,
Context
,
FieldCollector
,
Session
}
from
'
koishi
'
;
import
{
Argv
,
Command
,
Context
,
FieldCollector
,
Selection
,
Session
,
}
from
'
koishi
'
;
import
{
import
{
ContextScopeTypes
,
ContextScopeTypes
,
getContextProvideToken
,
getContextProvideToken
,
...
...
src/utility/koishi.interfaces.ts
View file @
883ec4ce
...
@@ -2,39 +2,19 @@ import { ModuleMetadata, Provider, Type } from '@nestjs/common';
...
@@ -2,39 +2,19 @@ import { ModuleMetadata, Provider, Type } from '@nestjs/common';
import
{
import
{
App
,
App
,
Argv
,
Argv
,
BeforeEventMap
,
Channel
,
Channel
,
Command
,
Command
,
Context
,
Context
,
EventMap
,
EventMap
,
FieldCollector
,
FieldCollector
,
MaybeArray
,
Modules
,
Modules
,
Plugin
,
Plugin
,
Selection
,
Session
,
Session
,
User
,
User
,
}
from
'
koishi
'
;
}
from
'
koishi
'
;
import
{
MetadataArrayMap
,
MetadataMap
}
from
'
./koishi.constants
'
;
import
{
MetadataArrayMap
,
MetadataMap
}
from
'
./koishi.constants
'
;
const
selectors
=
[
'
user
'
,
'
guild
'
,
'
channel
'
,
'
self
'
,
'
private
'
,
'
platform
'
,
]
as
const
;
type
SelectorType
=
typeof
selectors
[
number
];
type
SelectorValue
=
boolean
|
MaybeArray
<
string
|
number
>
;
type
BaseSelection
=
{
[
K
in
SelectorType
as
`$
${
K
}
`
]?:
SelectorValue
};
export
interface
Selection
extends
BaseSelection
{
$and
?:
Selection
[];
$or
?:
Selection
[];
$not
?:
Selection
;
}
export
interface
ContextSelector
{
export
interface
ContextSelector
{
select
?:
Selection
;
select
?:
Selection
;
useSelector
?:
OnContextFunction
;
useSelector
?:
OnContextFunction
;
...
@@ -117,7 +97,7 @@ export type EventNameAndPrepend = CommonEventNameAndPrepend<EventName>;
...
@@ -117,7 +97,7 @@ export type EventNameAndPrepend = CommonEventNameAndPrepend<EventName>;
type
OmitSubstring
<
type
OmitSubstring
<
S
extends
string
,
S
extends
string
,
T
extends
string
,
T
extends
string
>
=
S
extends
`
${
infer
L
}${
T
}${
infer
R
}
`
?
`
${
L
}${
R
}
`
:
never
;
>
=
S
extends
`
${
infer
L
}${
T
}${
infer
R
}
`
?
`
${
L
}${
R
}
`
:
never
;
export
type
BeforeEventName
=
OmitSubstring
<
EventName
&
string
,
'
before-
'
>
;
export
type
BeforeEventName
=
OmitSubstring
<
EventName
&
string
,
'
before-
'
>
;
export
type
BeforeEventNameAndPrepend
=
CommonEventNameAndPrepend
<
BeforeEventName
>
;
export
type
BeforeEventNameAndPrepend
=
CommonEventNameAndPrepend
<
BeforeEventName
>
;
...
...
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