This commit is contained in:
cdle
2023-06-01 15:24:23 +08:00
parent 1ee28c45c4
commit 0432c2505b
9 changed files with 165 additions and 59 deletions
+4 -4
View File
@@ -7,7 +7,7 @@
- 简单易用的消息搬运功能。
- 简单强大的自定义回复功能。
- 完整支持 ECMAScript 5.1 的插件系统,基于 [otto](https://github.com/robertkrimen/otto)。
- 支持通过内置的阉割版 `Express` / `request` ,接入互联网。
- 支持通过内置的阉割版 `Express` / `fetch` ,接入互联网。
- 内置 `Cron` ,轻松实现定时任务。
- 持久化的 `Bucket` 存储模块。
- 支持同时接入多个平台多个机器人,自己开发。
@@ -181,7 +181,7 @@ app.post(api, (req, res) => res.json(req.json()));
//第二步,请求第一步实现的接口
const port = Bucket("app").port ?? "8080"; // 获取http服务端口
const url = `http://127.0.0.1:${port}${api}`;
request({
fetch({
url,
method: "POST",
body: { value: "test" },
@@ -345,12 +345,12 @@ interface Response {
}
```
### request
### fetch
`net/http` 封装而成,如有更多需求可以联系作者。
```ts
function request(options: {
function fetch(options: {
url: string; //请求地址
method: string; //请求方法
headers: { [key: string]: string }; //请求头