fix: 扩展Messages
This commit is contained in:
parent
aec1927b99
commit
f2eb038f8b
|
@ -1,5 +1,17 @@
|
|||
## 新开发示例
|
||||
|
||||
- 消息回调
|
||||
|
||||
```ts
|
||||
import { Messages } from './src/core/index.js'
|
||||
const message = new Messages({
|
||||
priority: 9000,
|
||||
});
|
||||
message.response(/^你好/,async e=>{
|
||||
e.reply('你好')
|
||||
})
|
||||
```
|
||||
|
||||
- 图片组件
|
||||
|
||||
```tsx
|
||||
|
|
|
@ -4,7 +4,12 @@ import { plugin } from './plugin.js'
|
|||
/**
|
||||
* 插件super默认值
|
||||
*/
|
||||
export const PluginSuperDefine = {
|
||||
export const PluginSuperDefine: {
|
||||
name?: string,
|
||||
dsc?: string,
|
||||
event?: string,
|
||||
priority?: number
|
||||
} = {
|
||||
name: 'group-app',
|
||||
dsc: 'group-dsc',
|
||||
event: 'message',
|
||||
|
@ -21,6 +26,12 @@ export class Messages {
|
|||
fnc: string
|
||||
}[] = []
|
||||
|
||||
#init = PluginSuperDefine
|
||||
|
||||
constructor(init?: typeof PluginSuperDefine) {
|
||||
this.#init = init
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param reg
|
||||
|
@ -43,7 +54,7 @@ export class Messages {
|
|||
class Children extends plugin {
|
||||
constructor() {
|
||||
super({
|
||||
...PluginSuperDefine,
|
||||
...App.#init,
|
||||
rule: App.rule
|
||||
})
|
||||
for (const key of App.rule) {
|
||||
|
|
Loading…
Reference in New Issue