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
53edd5f3
Commit
53edd5f3
authored
Jan 05, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readme
parent
4e9c3886
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
README.md
README.md
+13
-3
No files found.
README.md
View file @
53edd5f3
...
...
@@ -307,6 +307,8 @@ export class AppService {
Koishi-Nest 使用一组装饰器进行描述指令的行为。这些装饰器需要和
`@UseCommand(def)`
一起使用。
*
`@CommandUse(callback, ...args)`
指令功能配置。等价于
`cmd.use(callback, ...args)`
。
*
`@CommandDescription(text: string)`
指令描述。等价于
`ctx.command(def, desc)`
中的描述。
*
`@CommandUsage(text: string)`
指令介绍。等价于
`cmd.usage(text)`
。
...
...
@@ -317,13 +319,11 @@ Koishi-Nest 使用一组装饰器进行描述指令的行为。这些装饰器
*
`@CommandShortcut(def: string, config?: Command.Shortcut)`
指令快捷方式。等价于
`cmd.shortcut(def, config)`
。
*
`@CommandDef((cmd: Command) => Command)`
手动定义指令信息,用于 Koishi-Nest 不支持的指令类型。
#### 指令参数
指令参数也使用一组装饰器对指令参数进行注入。下列装饰器应对提供者方法参数进行操作。
*
`@PutArgv(
)`
注入
`Argv`
对象
。
*
`@PutArgv(
field?: keyof Argv)`
注入
`Argv`
对象,或
`Argv`
对象的指定字段
。
*
`@PutSession(field?: keyof Session)`
注入
`Session`
对象,或
`Session`
对象的指定字段。
...
...
@@ -335,6 +335,8 @@ Koishi-Nest 使用一组装饰器进行描述指令的行为。这些装饰器
*
`@PutChannel(fields: string[])`
添加一部分字段用于观测,并将 Channel 对象注入到该参数。
*
`@PutNext()`
注入指令的 Next 方法。
关于 Koishi 的观察者概念详见
[
Koishi 文档
](
https://koishi.js.org/guide/database/observer.html#%E8%A7%82%E5%AF%9F%E8%80%85%E5%AF%B9%E8%B1%A1
)
。
*
`@PutUserName(useDatabase: boolean = true)`
注入当前用户的用户名。
...
...
@@ -553,6 +555,14 @@ export class AppModule {}
## 更新历史
### 4.2.0
*
适配新版 Koishi 。
*
增加了对应
`cmd.use`
的
`@CommandUse`
。
*
`@PutArgv`
现在支持参数,用于注入 Argv 对象的指定字段。
### 4.1.0
*
支持在提供者类顶层配置指令描述。
...
...
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