Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow for direct invocation de Koishi #191

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading