Skip to content

Commit

Permalink
Update workflow for direct invocation de Koishi
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan authored Sep 24, 2024
1 parent ddb7237 commit eeb1ce2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions zh-CN/manual/starter/direct.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ npm init
# 安装 Koishi 和相关插件
npm i koishi \
@koishijs/plugin-server \
@koishijs/plugin-console \
@koishijs/plugin-sandbox \
@koishijs/plugin-echo
Expand All @@ -49,6 +50,7 @@ yarn init
# 安装 Koishi 和相关插件
yarn add koishi
@koishijs/plugin-server \
@koishijs/plugin-console \
@koishijs/plugin-sandbox \
@koishijs/plugin-echo
Expand All @@ -62,16 +64,18 @@ yarn add typescript @types/node esbuild esbuild-register -D

```ts title=index.ts no-extra-header
import { Context } from 'koishi'
import server from '@koishijs/plugin-server'
import console from '@koishijs/plugin-console'
import * as sandbox from '@koishijs/plugin-sandbox'
import * as echo from '@koishijs/plugin-echo'

// 创建一个 Koishi 应用
const ctx = new Context({
port: 5140,
})
const ctx = new Context()

// 启用上述插件
ctx.plugin(server, {
port: 5140,
}) // 提供后端服务
ctx.plugin(console) // 提供控制台
ctx.plugin(sandbox) // 提供调试沙盒
ctx.plugin(echo) // 提供回声指令
Expand Down

0 comments on commit eeb1ce2

Please sign in to comment.