Miao-Yunzai/apps/example2.ts

39 lines
748 B
TypeScript
Raw Normal View History

2024-06-12 10:47:19 +08:00
import { Plugin } from 'yunzai/core'
2024-06-11 21:03:42 +08:00
/**
2024-06-17 22:52:15 +08:00
*
2024-06-11 21:03:42 +08:00
*/
2024-06-12 10:47:19 +08:00
export class example2 extends Plugin {
2024-06-17 22:52:15 +08:00
constructor() {
2024-06-11 21:03:42 +08:00
/**
name: '复读',
dsc: '复读用户发送的内容,然后撤回',
*/
2024-06-12 22:36:39 +08:00
super()
this.priority = 5000
this.rule = [
{
2024-06-15 11:39:06 +08:00
reg: /^#复读$/,
2024-06-12 22:36:39 +08:00
fnc: this.repeat.name
}
]
2024-06-11 21:03:42 +08:00
}
/**
2024-06-17 22:52:15 +08:00
*
2024-06-11 21:03:42 +08:00
*/
2024-06-17 22:52:15 +08:00
async repeat() {
2024-06-11 21:03:42 +08:00
/** 设置上下文后续接收到内容会执行doRep方法 */
this.setContext('doRep')
/** 回复 */
await this.reply('请发送要复读的内容', false, { at: true })
}
/**
*
*/
2024-06-17 22:52:15 +08:00
doRep() {
2024-06-11 21:03:42 +08:00
/** 复读内容 */
this.reply(this.e.message, false, { recallMsg: 5 })
/** 结束上下文 */
this.finish('doRep')
}
}