Skip to content

Commit

Permalink
upd readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Lhcfl committed Sep 2, 2023
1 parent 76fca68 commit fc7f73c
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Linquebot_v2

[api referances](https://lhcfl.github.io/Linquebot_v2/)
## How to use

开发中,请参阅dev.md
复制 `config.example.yml``config.yml`

```
cp config.example.yml config.yml
```

接下来,按 `config.example.yml` 的说明配置 `config.yml`

最后,启动

```
npm run build
npm run start
```

## Develop Plugin

[Api referances](https://lhcfl.github.io/Linquebot_v2/)

Linquebot的基本组成部分是 Plugin。每个 Plugin 单独在 `src/plugins/` 下有一个文件夹。

每个 Plugin 必须有一个 `index.js` (或 `index.ts` 然后编译) `export` 一个 `PluginInit` 类型的 `init`

下面是一个 Plugin 的 `index.ts` 的模板:

```typescript
import { commandHandleFunction } from '@/lib/command.js';
import { PluginInit } from '@/types/plugin.js';

const sayHello: commandHandleFunction = (app, msg) => {
app.bot.sendMessage(msg.chat.id, 'hello, world!');
},

const init: PluginInit = (app) => {
console.log('plugin loaded!');
app.registCommand({
command: 'hellp',
chat_type: 'all',
description: 'say hello',
handle: sayHello,
});
};

export { init };
```

0 comments on commit fc7f73c

Please sign in to comment.